aspose file tools*
The moose likes JDBC and the fly likes Urgent : Help needed in writing a SQL query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Urgent : Help needed in writing a SQL query" Watch "Urgent : Help needed in writing a SQL query" New topic
Author

Urgent : Help needed in writing a SQL query

Raj Sikka
Ranch Hand

Joined: Apr 11, 2003
Posts: 34
Hi ,
I have a table TEMP which has three columns say COL1,COL2,COL3
The data in that table is like :
COL1 COL2 COL3
--------------------------
1 65536 1
1 65536 2
1 65537 1
1 65537 1
1 65538 2
I need to write a query which displays results;
65536 1
65537 1
65538 2
i,e, For each distinct COL2 get the minimum of COL3.
Please help.
Thanks in advance,
Sree
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
select col2, min(col3) from temp group by col2;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Urgent : Help needed in writing a SQL query