|
Posted by J.O. Aho on 02/27/06 03:11
lallous wrote:
> Hello
>
> I have two questions:
>
> 1. I need to specify which ROWID to return info for.
> So I added a WHERE close right after the end of the inner joins.
>
> 2. When I executed the query, lots of records were returned instead of one
> expected record (which is the record with the given ROWID).
> So I added a GROUP BY.
>
> Is what I did correct, or you suggest a better way?
>
> SELECT T.rowid, N1.name, N2.name, N3.name
> FROM TABLE2 AS T
> INNER JOIN NAMES AS N1 ON T.nameid1 = N1.id
> INNER JOIN NAMES AS N2 ON T.nameid2 = N2.id
> INNER JOIN NAMES AS N3 ON T.nameid3 = N3.id
> WHERE T.rowid = 1
> GROUP BY T.rowid
"GROUP BY T.rowid" is quite useless as you already have limited the results to
be "T.rowid = 1", which means you will only have one group only and I guess
the rowid is a primary key/unique whcih makes you anyhow will only have one
row in the database with a specific rowid, so grouping will be quite pointless
for the rowid column.
//Aho
[Back to original message]
|