944,020 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 1174
  • MySQL RSS
Oct 29th, 2009
1

SQL to return two of each value from table?

Expand Post »
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!
Attached Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	17
Size:	25.8 KB
ID:	12367  
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
rickya100 is offline Offline
78 posts
since Mar 2008
Oct 30th, 2009
0
Re: SQL to return two of each value from table?
i think you might want to have a look at cursors, can't think of anything else at the moment though, sorry.
Reputation Points: 12
Solved Threads: 14
Junior Poster in Training
baki100 is offline Offline
79 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: Warning Code : 1265
Next Thread in MySQL Forum Timeline: php mysql





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC