| | |
SQL to return two of each value from table?
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 78
Reputation:
Solved Threads: 1
Hi everyone,
I sat down to create a what I thought was simple SQL query but once I got thinking about it I realised I'm not sure where to start.
The objective is to return two resorts from a Resorts table for each country code in that table.
Countries table - Lists all countries
Resorts table - Lists resorts and what country code they have which links them to the Countries table.
I've included a screenshot of what data is in the Resorts table. Basically I just need the two resort names from each country code. The other data can be ignored as it's just airport codes etc.
Any ideas to help me out?
Many thanks for any help!
I sat down to create a what I thought was simple SQL query but once I got thinking about it I realised I'm not sure where to start.
The objective is to return two resorts from a Resorts table for each country code in that table.
Countries table - Lists all countries
Resorts table - Lists resorts and what country code they have which links them to the Countries table.
I've included a screenshot of what data is in the Resorts table. Basically I just need the two resort names from each country code. The other data can be ignored as it's just airport codes etc.
Any ideas to help me out?
Many thanks for any help!
•
•
Join Date: Apr 2009
Posts: 41
Reputation:
Solved Threads: 10
0
#2 25 Days Ago
i think you might want to have a look at cursors, can't think of anything else at the moment though, sorry.
![]() |
Similar Threads
- extension .sql at end of table (MySQL)
- Hi, need advice on sql statement and table structure (MySQL)
- Autonumber in a SQL Server table (MS SQL)
- How can I select records randomly from MS SQL Server Table? (MS SQL)
- Error is [Microsoft][ODBC SQL Server Driver]Connection is busy (JSP)
- Send all items in a listBox to SQL server database table (ASP.NET)
Other Threads in the MySQL Forum
- Previous Thread: Warning Code : 1265
- Next Thread: php mysql
| Thread Tools | Search this Thread |
.net 3.5 2008 access ajax app asp autocomplete autosuggest c# c++ connection count cursor data database delphi derby developer development display dropdown editor hacker hint images integration java linux loop microsoft ms msdn netbeans news number office oracle php play qt query record remote report security server sharepoint sms software sophos sql sqlserver sqlserver2005 survey upload uploadatextfile vb.net video view vista web






