Hi all, I find difficulty in writing a single query for the following scenario. Please help.
I have a table as follows:
TABLE1 MapId SubId Name 1 0 A 2 0 B 3 1 c 4 0 D 4 1 D 4 2 D 5 2 E 6 1 F
Using a query I have to fetch 'Mapid' and 'Name' from TABLE1 such that the 'Mapid' should no be duplicated. Here 'Mapid' and 'Subid' is the PrimaryKeys. The result of the query should be: MapId SubId Name 1 0 A 2 0 B 3 1 c 4 0 D 5 2 E 6 1 F
I've tried so many times.but I couldn get. Please help.
Originally posted by Srinivasa Raghavan: I'm not sure whether it will work but did you try with distinct clause ?
SELECT DISTINCT MapId, Name FROM Table1.
That won't work because it is missing the subid in the resultset, and when you add that then you will not get the results you want.
Also, this looks like homework, so we want to give really good hints to help out, but not give the answer completely away. Like my hint really does give it a way in a MIN type of way.
Mark
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.