|
Posted by das on 03/02/06 00:10
Hi all,
How can I get a row that has only one occurence in a table? Not
through 'distinct' because this gets a single row that might have
multiple occurences, I want to get only rows that have only one
occurence in the table.
I tried the group by and within the having clause I placed the
count(myfield) = 1, did not work...
select f1, f2, count(f2)
from table1
inner join table2 on table1.id = table2.fid
where .....
group by f1, f2
having count(f2) = 1
gives me result like this: (basically in this situation, I dont want to
return any results)
f1 f2 count(f1)
--- --- -----------
1 a 1
2 a 1
any ideas sql gurus?
thanks
Navigation:
[Reply to this message]
|