| | |
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: 56
Reputation:
Solved Threads: 11
0
#2 Oct 30th, 2009
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 |
Tag cloud for sql
.net 3.5 2008 access ajax app array asp autocomplete autogrowth autosuggest c# c++ connection count cursor data database dbsize delphi derby developer development display dropdown editor exploit extensions generator hack hacker hint images integration java jsp linux loop maximum microsoft mining ms msaccess msdn multiple netbeans news number office oracle password php play qt query read record remote report result security select server sets sharepoint sms software sophos sql sql-injection sqlserver sqlserver2005 string survey tables update upload uploadatextfile vb.net video view vista warehouse web






