wood burning stoves 2.0*
The moose likes JDBC and the fly likes sql query issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "sql query issue" Watch "sql query issue" New topic
Author

sql query issue

swapnil kataria
Ranch Hand

Joined: Feb 26, 2011
Posts: 64
SELECT LOG_ID FROM LOG_TABLE
WHERE LOG_ID = 261 ORDER BY MODIFIED_DATE

-- a LOG_ID can have multiple record with different MODIFIED_DATE
suppose it will give follwing result

log_id
---------------
261
262
267
323
261

in this 261 is coming twice, but i want it only single time,
if i apply DISTINCT then i have to write like this

SELECT LOG_ID, MODIFIED_DATE FROM LOG_TABLE
WHERE LOG_ID = 261 ORDER BY MODIFIED_DATE

but it will also show duplicate records,
i can understand distinct will not work bcz 261 has two different record with different dates,
but don't want to pick same record second time, means only one record should come in result, but order should be maintained

please help
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4522
    
    5



luck, db
There are no new questions, but there may be new answers.
swapnil kataria
Ranch Hand

Joined: Feb 26, 2011
Posts: 64
ohmm, i have written, it should be order by modified date,
any way i have done it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sql query issue
 
Similar Threads
how to select random record from cursor
Complicated SQL query help
Getting java.sql.SQLException. Why?
Need help in an query development
Display the sequence numbers on the output rows of a select in Oracle 10g