|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
What households have more then 10 individuals.
I am sure that this is probably a very simple. But I am starting now using SQL.
I have a table with household_id and a individual_id columns. Of course some households can have tons of individuals. How can i get results of what household id's have more then say 10 individual id's assigned to it. |
|
#2
|
|||
|
|||
|
RE: What households have more then 10 individuals.
Use COUNT aggregate function from SQL.
You can use something like this: SELECT household_id, COUNT(individual_id) FROM table WHERE household_id = 'xxx' AND COUNT(individual_id) > 10 |
|
#3
|
|||
|
|||
|
RE: What households have more then 10 individuals.
skip the WHERE household_id='xxx' bit if you want a list of households ;) .. ie :
SELECT household_id, COUNT(individual_id) FROM table WHERE COUNT(individual_id) > 10 |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > What households have more then 10 individuals. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|