473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

One to Many with a "Not In" component

Hello,

I'm trying to compose a sql statement that will select some columns from a parent table and get the child records that DO NOT contain a certain value.

From a simple perspective I have Table "A" that has a one to many relationship with Table "b". I'm trying to get all of the records from Table "A" that only have child records from Table "b" with values of "X" and "Y" but not "Z".

So Table "A" has a record of "Joe Smith". "Joe Smith" can have children records from Table "b" of "X", "Y" and "Z". He would not qualify ffor retrieval. However, "Jane Smith" has children records of "X" and "Y" but no "Z". How did I retrieve "Jane Smith"?

thanks.
Sep 11 '07 #1
1 1303
ck9663
2,878 Expert 2GB
Hello,

I'm trying to compose a sql statement that will select some columns from a parent table and get the child records that DO NOT contain a certain value.

From a simple perspective I have Table "A" that has a one to many relationship with Table "b". I'm trying to get all of the records from Table "A" that only have child records from Table "b" with values of "X" and "Y" but not "Z".

So Table "A" has a record of "Joe Smith". "Joe Smith" can have children records from Table "b" of "X", "Y" and "Z". He would not qualify ffor retrieval. However, "Jane Smith" has children records of "X" and "Y" but no "Z". How did I retrieve "Jane Smith"?

thanks.
will something like this work?

Expand|Select|Wrap|Line Numbers
  1. select tablea.field1, tableb.field2
  2. from table inner join tableb on tablea.key = tableb.key and tableb.columnwithxy in ('X','Y')
Sep 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Maksim Chepel | last post by:
Just what the subject says. Thanks a lot!
7
by: qbsu21th | last post by:
Dear Sir/Madam, I'm writing a small VB6.0 and Access 2002 application in XP OS. I selected the data control property RecordSource, I got the "Unrecognized database format 'xxx/xx/*.mdb' " error....
13
by: gary | last post by:
Hi, We all know the below codes are dangerous: { int *p = new int; delete p; delete p; } And we also know the compilers do not delete p if p==NULL. So why compilers do not "p = NULL"...
2
by: HvG | last post by:
I'm sure this is a trivial question, but I cannot create an Outlook Object from a WebForm app, but can from a console app. or a Windows app. My COM knowledge is very poor sorry. ...
3
by: Torben Laursen | last post by:
Hi Is there a component in c# like the Frame in Delphi. I'm looking for a way to handle a large number of component in one winform and a frame style component could do the trick. Or is possible...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
13
by: Ragnar | last post by:
Hi, 2 issues left with my tidy-work: 1) Tidy transforms a "&amp;" in the source-xml into a "&" in the tidied version. My XML-Importer cannot handle it 2) in a long <title>-string a wrap is...
3
by: DrVitoti | last post by:
On that program the compiler says "parse error" on line 8, 10, 12 and 21, it also says "too many arguments" on lines 10, 12 and finally it says "at this port in" on lines 13, 14, 20 . How could I...
4
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.