I want to know the number of users logged in the last week from current day, that's why I try with this:
class UserRepository extends EntityRepository
{
public function findNumberLastWeek(){
$dql = "SELECT count(p) FROM UserBundle:User p WHERE p.lastLogin >= 'DATEADD(day,-7, GETDATE())'";
return $this->getEntityManager()
->createQuery($dql)
->getSingleScalarResult();
}
but does not work :(
I used this to do a similar feature in my app (counting user which were connected last day) :
/**
* Get the number of users which were connected between two dates
* #param startDate $
* #param endDate $
* #return array
*/
public function countUsersConnectedBetweenDate($startDate, $endDate) {
$qb = $this->createQueryBuilder('u');
$qb
->select('COUNT(u) as numberConnectedUsersLastDay')
->where('u.lastLogin BETWEEN :startDate AND :endDate')
->setParameter("startDate", $startDate)
->setParameter("endDate", $endDate);
return $qb->getQuery()->getSingleScalarResult();
}
and in the controller (it's only to get last day connection) :
$em = $this->getDoctrine()->getManager();
$startYesterday = new \DateTime();
$startYesterday->modify('yesterday');
$endYesterday = new \DateTime();
$endYesterday->modify('1 second ago');
$countConnectedUsersLastDay = $em->getRepository(User::class)->countUsersConnectedLastDay($startYesterday, $endYesterday);
You can adjust the two dates to match what you want, I've not tested it but you can try something like that :
$em = $this->getDoctrine()->getManager();
$lastWeek = new \DateTime();
$lastWeek->modify('-1 week');
$now = new \DateTime();
$countConnectedUsersLastDay = $em->getRepository(User::class)->countUsersConnectedLastDay($lastWeek, $now);
I hope that will help you.
lastLogin should be a DATE type
Try the following: p.lastLogin <= DATE_ADD(CURRENT_DATE(), -7, 'day')
Related
I need to fetch a sum value from database based on date range. I tried using Spring jdbcTemplate in the following ways. But it doesn't return anything.
public void getTotal(String from, string toDate){
String totalSql="select sum(b.finalAmount) as total from example a, example b "+
"where a.created >= TO_TIMESTAMP(:fromDate, 'MM-DD-YYYY') AND a.created < TO_TIMESTAMP(:toDate, 'MM-DD-YYYY hh24:mi:ss') "+
"and a.tradein_id=b.tradein_id";
List<Integer> checkAmt = jdbcTemplate.query(sql, new RowMapper<Integer>() {
#Override
public Integer mapRow(ResultSet rs, int rowNum) throws SQLException
{
int check = rs.getInt("TOTAL");
return check;
}
}, fromDate,toDate);
int checkAmount = jdbcTemplate.queryForObject(
totalSql, new Object[]{fromDate, toDate},Integer.class);
}
When I hardcode the fromDate and toDate in query, it works fine. I assume there is something wrong with the select parameters I am sending in.
Both from date and todate are String values from front end of the format 08/09/2016.
The SQL is using named parameters but the code is sending a list of arguments. Either use a NamedParameterJdbcTemplate and change how you're passing in arguments, or use a JdbcTemplate and change the SQL to use the ? placeholder instead of named arguments.
If you use NamedParameterJdbcTemplate, you have to refer to the parameters by name in the SQL, and you have to provide names when passing in the arguments. Put them in a map, like this (from the spring-jdbc documentation):
public int countOfActorsByFirstName(String firstName) {
String sql = "select count(*) from T_ACTOR where first_name = :first_name";
SqlParameterSource namedParameters = new MapSqlParameterSource("first_name", firstName);
return this.namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Integer.class);
}
Alternatively you can provide the arguments like this:
Map args = new HashMap();
args.put("fromDate", fromDate);
args.put("toDate", toDate);
jdbcTemplate.queryForObject(sql, args, Integer.class);
If you don't want to use named parameters, change the SQL to look like
String totalSql= "select sum(b.finalAmount) as total from example a, example b "+
"where a.created >= TO_TIMESTAMP(?, 'MM-DD-YYYY') AND a.created < TO_TIMESTAMP(?, 'MM-DD-YYYY hh24:mi:ss') "+
"and a.tradein_id=b.tradein_id"
and leave the rest alone.
I have this code written so far and it works for what I am doing but if I search for June 13 it will only look up until June 12, can someone help me figure whats wrong in my code? or where I can add a day interval? I tried and its just not working for me.
var db = Database.Open("RMS") ;
var selectCommand = "SELECT * FROM RMS";
var formSSO = "";
var fromDate= "";
var toDate= "";
formSSO = Request.QueryString["formSSO"];
fromDate = Request.QueryString["fromDate"];
toDate = Request.QueryString["toDate"];
selectCommand = "(SELECT * from RMS WHERE SSO LIKE #0)";
if(!Request.QueryString["fromDate"].IsEmpty() ) {
selectCommand = "SELECT * FROM RMS WHERE SSO LIKE #0 AND Created BETWEEN #1 AND #2";
}
if(Request.QueryString["formSSO"].IsEmpty() ) {
<div class="simple"><strong>*SSO ID is Required.</strong></div>
}
var data = db.Query(selectCommand, formSSO, fromDate, toDate);
var columns = new[]{"ID", "SSO", "Category", "System", "Subject", "Created"};
var grid = new WebGrid(data, ajaxUpdateContainerId: "grid", defaultSort: "ID", columnNames: columns);
if (Request.QueryString[grid.SortDirectionFieldName].IsEmpty()) {
grid.SortDirection = SortDirection.Descending;
}
}
One thing you can try is using <= and >= instead of BETWEEN like this:
selectCommand = "SELECT * FROM RMS WHERE SSO LIKE #0 AND Created >= #1 AND Created <= #2";
I hope that does the trick!
If not you can also brute force the to date to be one day further into the future and then use the BETWEEN operator just you are now like this:
DateTime to_date = Convert.ToDateTime(to_date_string);
to_date = to_date.AddDays(1);
to_date_string = to_date.ToString();
I have a Personnel Roles Table where employees are assigned daily roles or roles with specific start and end dates.
Managers have asked for a sort of manpower plan table which lists an employee’s daily role and this how I generate the table
private string CreateHTMLTable(Int32 month)
{
StringBuilder strBuilder = new StringBuilder();
System.Data.DataTable dtAllStaff = new System.Data.DataTable();
//get all staff
PersonelApplication.Classes.PersonelClass PersonnelClass = new PersonelClass();
dtAllStaff = PersonnelClass.GetAllPersonel();
//create manpower data table
System.Data.DataTable dtManPowerDataTable = new System.Data.DataTable();
//create montlhy dt
//get number of days in month
int daysInMonth = DateTime.DaysInMonth(DateTime.Now.Year, month);
//get first day in month
DateTime firstDayInMonth = new DateTime(DateTime.Now.Year, month, 1);
//get last day in month
DateTime lastDayInMonth = new DateTime();
lastDayInMonth = firstDayInMonth.AddMonths(1).AddDays(-1);
//start table
strBuilder.Append("<table>");
//create header based on number of days in the month
//append tr strat
strBuilder.Append("<tr>");
//add name header for personnle
strBuilder.Append("<th>");
strBuilder.Append("Staff");
strBuilder.Append("</th>");
for (int i = 1; i <= lastDayInMonth.Day; i++)
{
strBuilder.Append("<th>");
strBuilder.Append(i.ToString() + "/" + month.ToString());
strBuilder.Append("</th>");
}
//append tr end to header row
strBuilder.Append("</tr>");
System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection();
sqlConn.ConnectionString = ConnectionClass.CreateConnection.getConnectionString();
using (sqlConn = ConnectionClass.CreateConnection.publicGetConn())
{
sqlConn.ConnectionString = ConnectionClass.CreateConnection.getConnectionString();
try
{
sqlConn.Open();
if (sqlConn.State == ConnectionState.Open)
{
foreach (DataRow row in dtAllStaff.Rows)
{
string personnelName = "";
string personnelCode = "";
Int32 personnelID = 0; ;
personnelCode = row[1].ToString();
strBuilder.Append("<tr>");
strBuilder.Append("<td>");
strBuilder.Append(personnelCode);
strBuilder.Append("</td>");
for (int i = 1; i <= lastDayInMonth.Day; i++)
{
//here get the each employee's planned role as well
//as actual role
}
strBuilder.Append("</tr>");
}
}
}
catch (Exception ex)
{
//pouplate later
}
finally
{
}
}
//end table
strBuilder.Append("</table>");
return strBuilder.ToString();
}
My issue is the SQL function which will return the employees role for a particular day.
--actual end date for this role is '08-18-2012'
declare #sdate date
set #sdate= '08-14-2012'
SELECT
CONVERT(date,startdate,101)
,CONVERT(date,EndDate,101)
,StartDate
,EndDate
,fk_PersonelID
,fk_RoleID
FROM [dbo].JobRolesTable
where #sdate between StartDate and EndDate
and fk_PersonelID = 40
But If I do a search for the next day which is the '08-15-2012’,I get nada
Bascially I want to return an employee’s role on any day of the month and ‘na’ if there’s none
I don’t want to use a cursor for this but is there another way I can achieve this
DECLARE #sdate DATE = '20120814';
SELECT
CONVERT(DATE,StartDate,101) -- what is the purpose of 101 here?
,CONVERT(DATE,EndDate,101) -- what is the purpose of 101 here?
,StartDate
,EndDate
,fk_PersonelID
,fk_RoleID
FROM [dbo].JobRolesTable
WHERE #sdate >= StartDate
AND #sdate < DATEADD(DAY, 1, EndDate)
AND fk_PersonelID = 40;
You are probably populating your parameters incorrectly.
If your query is of the form
SELECT *
FROM Table
WHERE (#SearchDate BETWEEN #StartDate AND #EndDate) AND Id=#Id
(which yours appears to be), then it will return the correct values from the db as long as the dates are being specified correctly.
Can you show the code where you're actually attempting to use the SqlConnection that you're opening in the posted code?
I display my date in CGridView as: "22.6.2012 22:53" with:
array('name' => 'date',
'value' => date("j.n.Y G:i", strtotime($model->date))
),
But in my filter, I need to search in this format (which is in the database) to get results: "2012-06-22 22:53".
How can I make my filter to work in the format that is displayed in my CGridView? I've searched for an answer but haven't found one, I've also tried adding the date function in my model search() for this attribute:
$criteria->compare('date', date("j.n.Y G:i", strtotime($this->date), true);
but then I just get an empty list :)
Help would be greatly appreciated.
To begin with, you should not be using the value property to control the formatting of dates. The proper way is to set the type property to 'date' and, if you do not do this already, set CApplication.language to target the appropriate locale.
For the filter it would be best for the user if you use a CJuiDatePicker widget to let the user visually pick the date; there's a short and to-the-point guide on how to do that here.
Update:
Formatting columns with type == 'date' is done through CGridView.formatter, for which if you do not explicitly set a value the default is whatever the 'format' application component is. So you can specify and configure a CFormatter on the spot, or if you want to use the application's formatter but with slight modifications you can do
$formatter = clone Yii::app()->format;
$formatter->dateFormat = 'whatever'; // or $formatter->dateTimeFormat
and then assign this instance to CGridView.formatter.
compare() makes a sql sentence with the input, so I had to change the input to my wanted format.
my function:
function changeDateToDBformat($datum) {
if (strstr($datum, '.') || strstr($datum, ':')) {
$formats = array('!j.n', '!j.n.Y', '!j.n.Y H:i', '!n.Y H:i', '!n.Y', '!H:i', '!j.n.Y H', '!n.Y H', '!Y H:i', '!Y H');
$date = false;
foreach ($formats as $format) {
$date = DateTime::createFromFormat($format, $datum);
if (!($date === false)) {
$izbraniFormat = $format;
break;
}
}
if (!$date === false) {
$datum1 = $date->format('Y-m-d H:i');
$date2 = DateTime::createFromFormat(substr($izbraniFormat, 1, strlen($izbraniFormat)), $datum);
$datum2 = $date2->format('Y-m-d H:i');
$datumcas1 = explode(' ', $datum1);
$datumcas2 = explode(' ', $datum2);
$prvidatum = explode('-', $datumcas1[0]);
$drugidatum = explode('-', $datumcas2[0]);
$koncniDatum = '';
for ($a = 0; $a < sizeof($prvidatum); $a++) {
if ($prvidatum[$a] == $drugidatum[$a])
$koncniDatum .= '-' . $prvidatum[$a];
}
$koncniCas = '';
$prvicas = explode('-', $datumcas1[1]);
$drugicas = explode('-', $datumcas2[1]);
for ($a = 0; $a < sizeof($prvicas); $a++) {
if ($prvicas[$a] == $drugicas[$a])
$koncniCas .= ':' . $prvicas[$a];
}
$koncniDatum = substr($koncniDatum, 1, strlen($koncniDatum));
if (strlen($koncniCas) > 0)
$koncniDatum .= ' ' . substr($koncniCas, 1, strlen($koncniCas));
$datum = $koncniDatum;
}
}
return $datum;
}
//translations:
//izbrani == selected
//datum == date
//cas == time
//koncni == end
//prvi == first
//drugi == second
With this, a user can enter date in the format "j.n.Y H:i" and also just portions of this format (j.n, n.Y, Y H:i,...).
I would like to thank Jon and nickb for help! link
Like many others I also struggled with this, well displaying the grid wasn't the problem, but filtering in the localized datetime was!
So I created my own formatter, used it in the search() function of my models (when passing the search parameters to compare()) and it works like a charm.
I can now filter on date/datetime fields in any localization (I use Dutch):
"30-12-2018" becomes "2018-12-30"
">30-12-2018" becomes ">2018-12-30"
"30-12-2018 23:59:49" becomes "2018-12-30 23:59:49"
">=30-12-2018 23:59:49" becomes ">=2018-12-30 23:59:49"
My localization:
// dateFormat['short'] = 'dd-MM-yyyy'
// timeFormat['medium'] = 'HH:mm:ss'
Yii::app()->format->datetimeFormat = strtr(Yii::app()->locale->dateTimeFormat,
array("{0}" => Yii::app()->locale->getTimeFormat('medium'),
"{1}" => Yii::app()->locale->getDateFormat('short')));
Yii::app()->format->dateFormat = 'short';
Yii::app()->format->timeFormat = 'medium';
My CGridView contains the following date time column:
'mutation_date_time:dateTime'
And (a snippet of) my own formatter with some handy functions:
class Formatter extends CLocalizedFormatter
{
public function formatWithoutSearchOperator($value)
{
// This snippet is taken from CDbCriteria->compare()
if(preg_match('/^(?:\s*(<>|<=|>=|<|>|=))?(.*)$/',$value,$matches))
{
$value=$matches[2];
$op=$matches[1];
}
else
$op='';
return $value;
}
public function formatOnlySearchOperator($value)
{
// This snippet is taken from CDbCriteria->compare()
if(preg_match('/^(?:\s*(<>|<=|>=|<|>|=))?(.*)$/',$value,$matches))
{
$value=$matches[2];
$op=$matches[1];
}
else
$op='';
return $op;
}
/*
* Format a localized datetime back to a database datetime (Y-m-d H:i:s).
* If a comparison operator is given, it is preserved. So strip it if you need to save the date in the database.
* If no time given, it's also not returned (MySQL database appends '00:00:00' as time to it upon saving).
* With this function the following localized datetimes just work like the stock datetime filters:
* - "30-12-2018" becomes "2018-12-30"
* - "30-12-2018 " becomes "1970-01-01" (note the extra space in input)
* - ">30-12-2018" becomes ">2018-12-30"
* - "30-12-2018 23:59:49" becomes "2018-12-30 23:59:49"
* - ">=30-12-2018 23:59:49" becomes ">=2018-12-30 23:59:49"
*
* For save() and afterFind() integration see:
* https://github.com/YetOpen/i18n-datetime-behavior
*/
public function formatToDatabaseDatetime($value)
{
// get the comparison operator from the string:
$comparator = $this->onlySearchOperator($value);
// get the datetime without the comparison operator:
$datetime = $this->withoutSearchOperator($value);
// parse the given datetime according to the locale format to a timestamp
$datetime_parsed = CDateTimeParser::parse(
$datetime,
strtr(
Yii::app()->locale->datetimeFormat,
array(
"{0}" => Yii::app()->locale->getTimeFormat(Yii::app()->format->timeFormat),
"{1}" => Yii::app()->locale->getDateFormat(Yii::app()->format->dateFormat)
)
)
);
// if its not a valid date AND time, check if it can be parsed to a date only:
if($datetime_parsed === false)
{
$date_parsed = CDateTimeParser::parse(
$datetime,
Yii::app()->locale->getDateFormat(Yii::app()->format->dateFormat)
);
}
// If no time part given, also output only the date
if($datetime_parsed===false)
{
$transformed = date(
'Y-m-d',
$date_parsed
);
}
else
{
$transformed = date(
'Y-m-d H:i:s',
$datetime_parsed
);
}
return $comparator . $transformed;
}
}
And within my search() function in my CActiveRecord model I use the following to compare the localized datetime with the records in the database:
$criteria->compare('mutation_date_time',Yii::app()->format->toDatabaseDateTime(trim($this->mutation_date_time)),true);
Please note the trim() there, that's by design (see function description formatToDatabaseDateTime()).
A big difference with filtering directly in correct database format: an invalid date converts to "1970-01-01"!
I highly appreciate feedback and I really hope my code helps somebody!
I have an answered StackOverflow question about how to combine to legacy CHAR database date and time fields into one .NET DateTime property in my POCO
here (thanks much Berryl!). Now i am trying to get a custom ICritera query to work against that very DateTime property to no avail. here's my query:
ICriteria criteria =
Session.CreateCriteria<InputFileLog>()
.Add(Expression.Gt(MembersOf<InputFileLog>.GetName(x => x.FileCreationDateTime), DateTime.Now.AddDays(-14)))
.AddOrder(Order.Desc(Projections.Id()))
.CreateCriteria(typeof(InputFile).Name)
.Add(Expression.Eq(MembersOf<InputFile>.GetName(x => x.Id), inputFileName));
IList<InputFileLog> list = criteria.List<InputFileLog>();
And here's the query it's generating:
SELECT this_.input_file_token as input1_9_2_,
this_.file_creation_date as file2_9_2_,
this_.file_creation_time as file3_9_2_,
this_.approval_ind as approval4_9_2_,
this_.file_id as file5_9_2_,
this_.process_name as process6_9_2_,
this_.process_status as process7_9_2_,
this_.input_file_name as input8_9_2_,
gonogo3_.input_file_token as input1_6_0_,
gonogo3_.go_nogo_ind as go2_6_0_,
inputfile1_.input_file_name as input1_3_1_,
inputfile1_.src_code as src2_3_1_,
inputfile1_.process_cat_code as process3_3_1_
FROM input_file_log this_
left outer join go_nogo gonogo3_ on this_.input_file_token=gonogo3_.input_file_token
inner join input_file inputfile1_ on this_.input_file_name=inputfile1_.input_file_name
WHERE this_.file_creation_date > :p0 and
this_.file_creation_time > :p1 and
inputfile1_.input_file_name = :p2
ORDER BY this_.input_file_token desc;
:p0 = '20100401',
:p1 = '15:15:27',
:p2 = 'LMCONV_JR'
The query is exactly what i would expect, actually, except it doesn't actually give me what i want (all the rows in the last 2 weeks) because in the DB it's doing a greater than comparison using CHARs instead of DATEs. I have no idea how to get the query to convert the CHAR values into a DATE in the query without doing a CreateSQLQuery(), which I would like to avoid. Anyone know how to do this?
UPDATE:
I've been looking into trying to use Projections.SqlFunction() or formulas to accomplish this, but to no avail so far. Here's the code i have using SqlFunction(), but i get an NHibernate.QueryException : property does not map to a single column: FileCreationDateTime error:
DateTime twoWeeksAgo = DateTime.Now.AddDays(-14);
ICriteria criteria =
Session.CreateCriteria<InputFileLog>()
.Add(Restrictions.Gt(Projections.SqlFunction("to_date", NHibernateUtil.DateTime, Projections.Property(MembersOf<InputFileLog>.GetName(x => x.FileCreationDateTime))), twoWeeksAgo))
//.Add(Expression.Gt(MembersOf<InputFileLog>.GetName(x => x.FileCreationDateTime), DateTime.Now.AddDays(-14)))
.AddOrder(Order.Desc(Projections.Id()))
.CreateCriteria(typeof(InputFile).Name)
.Add(Expression.Eq(MembersOf<InputFile>.GetName(x => x.Id), inputFileName));
I'm sure i'm doing something wrong here and it doesn't like it still anyway because FileCreationDateTime uses a custom ICompositeUserType which splits the .NET DateTime property into two Oracle SQL CHAR columns (see this StackOverflow question for details).
I finally figure this out! here's the code (for some reason StackOverflow is making some of the methods names in the this first code snippet the syntax color of a type):
IList<InputFileLog> list = null;
DateTime twoWeeksAgo = DateTime.Now.AddDays(-14);
IProjection datePropProj =
DefaultStringFileCreationDateTimeType.GetFileCreationDateToDateSQLProjection();
IProjection timePropProj =
DefaultStringFileCreationDateTimeType.GetFileCreationTimeToDateSQLProjection();
IProjection dateConstProj =
DefaultStringFileCreationDateTimeType.GetFileCreationDateToDateSQLFunction(twoWeeksAgo);
IProjection timeConstProj =
DefaultStringFileCreationDateTimeType.GetFileCreationTimeToDateSQLFunction(twoWeeksAgo);
ICriteria criteria =
Session.CreateCriteria<InputFileLog>()
.Add(Restrictions.Or(Restrictions.GtProperty(datePropProj, dateConstProj),
Restrictions.And(Restrictions.EqProperty(datePropProj, dateConstProj),
Restrictions.GeProperty(timePropProj, timeConstProj))))
.AddOrder(Order.Desc(Projections.Id()))
.CreateCriteria(typeof(InputFile).Name)
.Add(Expression.Eq(MembersOf<InputFile>.GetName(x => x.Id), inputFileName));
list = criteria.List<InputFileLog>();
And here's the methods i used to create the SQLProjections and SQLFunctions. i put them in my ICompositeUserType (DefaultStringFileCreationDateTime) that i used for the custom type mapping on the FileCreationDateTime property.
public class DefaultStringFileCreationDateTime : ICompositeUserType
{
.
.
.
public const string DotNetDateFormat = "yyyyMMdd";
public const string DotNetTimeFormat = "HH:mm:ss";
public const string DbDateFormat = "YYYYMMDD";
public const string DbTimeFormat = "HH24:MI:SS";
private const string _nullDateRepresentationInDb = "00000000";
public struct DatabaseFieldNames
{
/// <summary>
/// File creation date column name.
/// </summary>
public const string FileCreationDate = "file_creation_date";
/// <summary>
/// File creation time column name.
/// </summary>
public const string FileCreationTime = "file_creation_time";
}
public static IProjection GetFileCreationDateToDateSQLProjection()
{
return ProjectionUtil.GetToDateSQLProjection(DatabaseFieldNames.FileCreationDate, DbDateFormat, NHibernateUtil.DateTime);
}
public static IProjection GetFileCreationTimeToDateSQLProjection()
{
return ProjectionUtil.GetToDateSQLProjection(DatabaseFieldNames.FileCreationTime, DbTimeFormat, NHibernateUtil.DateTime);
}
public static IProjection GetFileCreationDateToDateSQLFunction(DateTime dt)
{
return ProjectionUtil.GetToDateSQLFunction(dt, DotNetDateFormat, DbDateFormat);
}
public static IProjection GetFileCreationTimeToDateSQLFunction(DateTime dt)
{
return ProjectionUtil.GetToDateSQLFunction(dt, DotNetTimeFormat, DbTimeFormat);
}
}
I was already using the consts DatabaseFieldNames struct for the PropertyNames member implementation, so I was able to reuse these hard-coded column names for the Projections i needed as well.
Here's the Projection utility class where the generic to_date methods live:
public class ProjectionUtil
{
public static IProjection GetToDateSQLProjection(
string columnName, string dbToDateFormat, IType returnType)
{
return Projections.SqlProjection(
string.Format("to_date({0}, '{1}') as {0}", columnName, dbToDateFormat),
new string[] { columnName },
new IType[] { returnType });
}
public static IProjection GetToDateSQLFunction(
DateTime dt, string dotNetFormatString, string dbFormatString)
{
return Projections.SqlFunction(
"to_date",
NHibernateUtil.DateTime,
Projections.Constant(dt.ToString(dotNetFormatString)),
Projections.Constant(dbFormatString));
}
}
Finally, here's the Oracle SQL that NHibernate generates:
SELECT
this_.input_file_token as input1_9_2_,
this_.file_creation_date as file2_9_2_,
this_.file_creation_time as file3_9_2_,
this_.approval_ind as approval4_9_2_,
this_.file_id as file5_9_2_,
this_.process_name as process6_9_2_,
this_.process_status as process7_9_2_,
this_.input_file_name as input8_9_2_,
gonogo3_.input_file_token as input1_6_0_,
gonogo3_.go_nogo_ind as go2_6_0_,
inputfile1_.input_file_name as input1_3_1_,
inputfile1_.src_code as src2_3_1_,
inputfile1_.process_cat_code as process3_3_1_
FROM
input_file_log this_
left outer join go_nogo gonogo3_ on this_.input_file_token=gonogo3_.input_file_token
inner join input_file inputfile1_ on this_.input_file_name=inputfile1_.input_file_name
WHERE
(
to_date(file_creation_date, 'YYYYMMDD') > to_date(:p0, :p1) or
(
to_date(file_creation_date, 'YYYYMMDD') = to_date(:p2, :p3) and
to_date(file_creation_time, 'HH24:MI:SS') >= to_date(:p4, :p5)
)
) and
inputfile1_.input_file_name = :p6
ORDER BY this_.input_file_token desc;
:p0 = '20100415',
:p1 = 'YYYYMMDD',
:p2 = '20100415',
:p3 = 'YYYYMMDD',
:p4 = '18:48:48',
:p5 = 'HH24:MI:SS',
:p6 = 'LMCONV_JR'
can't believe i got this one! i thought i was going to have to resort to an ISQLQuery for sure!