Web Design and Development Forums

4 hours trying to do this query

This is a discussion on "4 hours trying to do this query" within the MSSQL & Access section. This forum, and the thread "4 hours trying to do this query are both part of the Databases category.


Go Back   Webforumz.com > Databases > MSSQL & Access

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Aug 31st, 2007, 12:49   #1 (permalink)
Junior Member
 
Join Date: Jul 2007
Location: England
Age: 24
Posts: 20
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.
Xyis is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Aug 31st, 2007, 16:07   #2 (permalink)
Junior Member
 
Join Date: Jul 2007
Location: England
Age: 24
Posts: 20
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))
Xyis is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
exclude, query, sql

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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
MySQL query query dangergeek MySQL 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 Forum 7 Nov 6th, 2005 16:45
Query accessman MSSQL & Access 0 Sep 22nd, 2005 19:48



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 09:22.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59