i have a table called tblpictures which look something like this..
filename|ID
----
1 |p1
2 |p1
3 |p2
4 |p2
5 |p3
is there a way to retrieve only 1 row for each ID? how will the select statement looks like?? please help me..Which row would you want?
If you just want a distinct list of IDs, then this will do:
select distinct ID from YourTable|||erm no i want to show 1 filename and 1 ID for each ID|||You could probably get away with :
select max(filename), id from tblPictures group by id
if this is what you are looking for ...
:cool:
Showing posts with label tblpictures. Show all posts
Showing posts with label tblpictures. Show all posts
Saturday, February 25, 2012
retrieve only 1 row for each ID (was "Help on SQL! Urgent..")
Labels:
database,
filenameid,
microsoft,
mysql,
oracle,
p12,
p13,
p24,
p25,
retrieve,
row,
server,
sql,
table,
tblpictures,
urgent
Subscribe to:
Posts (Atom)