|
View previous topic :: View next topic
|
| Author |
Message |
adarsh444
New User
Joined: 02 Nov 2006 Posts: 17
|
|
|
|
The below query is not giving the appropriate results in my program.
Is order by with fetch first row valid.?
SELECT DATE_1,
DATE_2,
FROM TABLE001
WHERE ACCT_ID = '1'
AND ACCT_NBR = '13244'
AND SUR_NAME = (
SELECT FAC_NAME
FROM TABLE002
WHERE ACCT_ID = '0256'
)
ORDER BY DATE_3 DESC, TIME_3 DESC
FETCH FIRST ROW ONLY |
|
| Back to top |
|
 |
BuildersHeaven
New User
.jpg)
Joined: 17 Apr 2006 Posts: 2
|
|
|
|
Can you better explain what you should receive and what you receive now ?
You should also write the Unix key of tabe001 an table002 ... and , if necessary, the tables of every column.
check the join also.
 |
|
| Back to top |
|
 |
priyesh.agrawal
Senior Member

Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
adarsh,
Use ORDER BY at last after FETCH. Like this...
| Code: |
FETCH FIRST ROW ONLY
ORDER BY DATE_3 DESC, TIME_3 DESC |
|
|
| Back to top |
|
 |
|
|