![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm not sure I've come to the right place, so any help would be most appreciated. In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? |
#3
| |||
| |||
|
|
In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? Yes. |
#4
| |||
| |||
|
|
In article <ZDuab.216$uO1.20255791 (AT) mantis (DOT) golden.net>, bbadour (AT) golden (DOT) net says... In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? Yes. Okaaay. Care to help me out? |
#5
| |||
| |||
|
|
I'm not sure I've come to the right place, so any help would be most appreciated. In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? Thanks in advance, \Anders |
#6
| |||
| |||
|
|
"Anders Steinlein" <dinhelt (AT) online (DOT) noSPAM> wrote in message news:MPG.19d4790bf8c57019896dd (AT) news (DOT) online.no... I'm not sure I've come to the right place, so any help would be most appreciated. In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? Thanks in advance, \Anders CREATE TABLE Countries ( country_id CHAR(2) NOT NULL PRIMARY KEY, password VARCHAR(10) NULL ) CREATE TABLE Cities ( country_id CHAR(2) NOT NULL REFERENCES Countries (country_id), city VARCHAR(20) NOT NULL, PRIMARY KEY (country_id, city) ) SELECT CNT.country_id FROM Countries AS CNT INNER JOIN Cities AS CIT ON CNT.country_id = CIT.country_id WHERE CNT.password IS NULL GROUP BY CNT.country_id HAVING COUNT(*) <= 10 |
#7
| |||
| |||
|
|
In article <ZDuab.216$uO1.20255791 (AT) mantis (DOT) golden.net>, bbadour (AT) golden (DOT) net says... In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? Yes. Okaaay. Care to help me out? \Anders |
#8
| |||
| |||
|
|
"John Gilson" <jag (AT) acm (DOT) org> wrote in message news:ZWuab.6834$nU6.1269431 (AT) twister (DOT) nyc.rr.com... "Anders Steinlein" <dinhelt (AT) online (DOT) noSPAM> wrote in message news:MPG.19d4790bf8c57019896dd (AT) news (DOT) online.no... I'm not sure I've come to the right place, so any help would be most appreciated. In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? Thanks in advance, \Anders CREATE TABLE Countries ( country_id CHAR(2) NOT NULL PRIMARY KEY, password VARCHAR(10) NULL ) CREATE TABLE Cities ( country_id CHAR(2) NOT NULL REFERENCES Countries (country_id), city VARCHAR(20) NOT NULL, PRIMARY KEY (country_id, city) ) SELECT CNT.country_id FROM Countries AS CNT INNER JOIN Cities AS CIT ON CNT.country_id = CIT.country_id WHERE CNT.password IS NULL GROUP BY CNT.country_id HAVING COUNT(*) <= 10 John, Do you complete your kids' homework for them too? |
#9
| |||
| |||
|
|
"Bob Badour" <bbadour (AT) golden (DOT) net> wrote "John Gilson" <jag (AT) acm (DOT) org> wrote in message news:ZWuab.6834$nU6.1269431 (AT) twister (DOT) nyc.rr.com... "Anders Steinlein" <dinhelt (AT) online (DOT) noSPAM> wrote in message news:MPG.19d4790bf8c57019896dd (AT) news (DOT) online.no... I'm not sure I've come to the right place, so any help would be most appreciated. In two tables, cities and countries, the first references the latter (foreign key). I want to retrieve the country ids (the column shared by both tables) where the values in the password column in the countries table is null, but those country ids found should not have more than 10 occurences in the cities table. Can this be done? Thanks in advance, \Anders CREATE TABLE Countries ( country_id CHAR(2) NOT NULL PRIMARY KEY, password VARCHAR(10) NULL ) CREATE TABLE Cities ( country_id CHAR(2) NOT NULL REFERENCES Countries (country_id), city VARCHAR(20) NOT NULL, PRIMARY KEY (country_id, city) ) SELECT CNT.country_id FROM Countries AS CNT INNER JOIN Cities AS CIT ON CNT.country_id = CIT.country_id WHERE CNT.password IS NULL GROUP BY CNT.country_id HAVING COUNT(*) <= 10 John, Do you complete your kids' homework for them too? Bob, of course not, but there's nothing immediately discernable to me that would lead me to conclude, or even strongly suspect, that this is a homework assignment. If this is your conclusion, please substantiate. |
#10
| |||
| |||
|
|
SELECT CNT.country_id FROM Countries AS CNT INNER JOIN Cities AS CIT ON CNT.country_id = CIT.country_id WHERE CNT.password IS NULL GROUP BY CNT.country_id HAVING COUNT(*) <= 10 John, Do you complete your kids' homework for them too? |
![]() |
| Thread Tools | |
| Display Modes | |
| |