sql query [message #257486] |
Wed, 08 August 2007 08:19 |
|
Assume the following scenario....
Table a1
field1 number(2)
field2 varchar2(10)
field1 is primary key
Table b1
field1 number(2)
field3 date
field1 is foreign key
I have 3 rows in table a1
1 John
2 Jack
3 Mike
I have the following rows in table b1
1 02-AUG-07
1 03-AUG-07
1 07-AUG-07
1 08-AUG-07
2 05-AUG-07
2 08-AUG-07
3 03-AUG-07
3 08-AUG-07
3 09-AUG-07
Assume that today is '08-AUG-07'
I need to pick only those records which shows todays date only
in this example the output should be only
1 08-AUG-07
2 08-AUG-07
|
|
|
|
|
|
Re: sql query [message #257494 is a reply to message #257486] |
Wed, 08 August 2007 08:33 |
|
The main purpose is finding the maximum date for each group of records in the detail table and then filtering only those records where the max date is '08-AUG-07'
i have tried doing this...
Select field1,max(field3) from b1 where
to_char(field3,'DD-MM-YYYY')= to_char(sysdate,'DD-MM-YYYY')
group by internalno;
|
|
|
|
|