Reply to Select row with only ONE occurence

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация