SQL query help [message #639398] |
Mon, 06 July 2015 14:00 |
|
gorants
Messages: 85 Registered: May 2014 Location: ATL
|
Member |
|
|
Hello all,
I want to write sql query first sort by create date then upon sort fetch the first record
Below is my sql query, but it is giving error ORA-00907: missing right parenthesis
SELECT *
FROM ord
WHERE id IN
(SELECT id
FROM ord
WHERE id LIKE '09%'
ORDER BY created_dttm DESC
)
AND rownum <=1;
could you let me know what is wrong here
|
|
|
|
|
|
|
|
|
|
Re: SQL query help [message #639419 is a reply to message #639410] |
Tue, 07 July 2015 00:05 |
|
Michel Cadot
Messages: 68643 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
gorants wrote on Tue, 07 July 2015 05:13i tried , it is not working as expected. it is always giving 4th record from result not the 1st record.
As we have not the specification of what you are trying to do, we can only make blind shot until we'll find a query which we'll give the expected result which may not the correct one.
Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
|
|
|