This is a discussion on "4 hours trying to do this query" within the Databases section. This forum, and the thread "4 hours trying to do this query are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
4 hours trying to do this query
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
4 hours trying to do this query
Hi, i have spent too long on this now and am getting no where. im going to take a break and come back to it again soon. but just incase someone out there can do this in their sleep i thought i would plea for help...
I have 3 tables. clubs -------- cID cName cInfo sponsors -------- sID sName sInfo club_sponsors --------- cID sID club_sponsors stores which sponsor shows up in which club. What i am trying to do is create a query that will display all the clubs excluding clubs that a perticular sponsor has already been added to. Any help is much appreciated. |
|
|
|
#2
|
|||
|
|||
|
Re: 4 hours trying to do this query
Done it, for those that want to know:
SELECT cID, cName FROM clubs WHERE (cID NOT IN (SELECT cID FROM (SELECT club_sponsors.cID, club_sponsors.sID FROM (clubs clubs_1 INNER JOIN club_sponsors ON clubs_1.cID = club_sponsors.cID) WHERE (club_sponsors.sID = @sID)) derivedtbl_1)) |
![]() |
| Tags |
| exclude, query, sql |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How many hours does it take you to design a web site? | tox0tes | Webforumz Cafe | 8 | Sep 13th, 2007 17:54 |
| query about my $query | ziggi | PHP Forum | 9 | Aug 10th, 2007 14:05 |
| MySQL query query | dangergeek | Databases | 3 | Apr 12th, 2007 12:45 |
| Hosting off peak hours question | RealMetrics | Hosting & Domains | 8 | Aug 15th, 2006 18:38 |
| Hours wasted - help desperately sought after | crimsone | Graphics and 3D | 7 | Nov 6th, 2005 16:45 |