Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Help with query - is it possible to...???
Old 04-25-2006, 09:24 AM Help with query - is it possible to...???
Junior Talker

Posts: 2
Trades: 0
Hey all

Just wondering whether it is possible to do the following in one query - if so how would i go about it?

Any help will be very much appreciated

There are three tables: Table A, B, C for example. Table B is a junction table that splits up the many to many relationship between Tables A and C.

What I would like to do is to display all the records from table A which do not exist for a given value in Table C (inputted parameter).

Example if the tables have the following values :
A {1,2,3,4,5}
C {A,B,C}
B {1,A
2,A
2,B
1,C}

(note table b has 2 cols - so first row in table b reads 1, a)

If ‘a’ was input parameter query should return 3,4,5
‘B’ would return 1,3,4,5
‘C’ returns 2,3,4,5.

My query as it currently stands:

Select a.* from a left join b on a.id=b.col1 where b.col2<>’parameter’;

So if a was the input parameter it would display all the records from table A - although I don’t want it to display number 2 or number 1 but they appear as other records from the junction table relate to them. How can I resolve this in one query???-if it is possible???

Hope this makes sense???!!!!

Thanks!

Sub.
sub_woofer is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-26-2006, 03:07 AM Re: Help with query - is it possible to...???
Junior Talker

Posts: 2
Trades: 0
Got it sorted!....

sub_woofer is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help with query - is it possible to...???
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29771 seconds with 12 queries