Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help

Status
Not open for further replies.

Bell1991

Programmer
Aug 20, 2003
386
US
I have two tables:

TableA
txtAID text ,
numAge int ,
txtCityName text ,
txtState text

TableB
txtBID text,
numAge int ,
txtCityName text ,
txtState text

Both tables have several other fields.. and they are not normalized..

Here is what i am looking to do:

Select everything from tableA where txtBID = '9' since the other 3 column are the same.. Does that make sense?

These two tables are not related..

Select numAID, numAge, txtCityName, txtState from tblA where (Select numAge, numCityName, txtState from tblB where txtBID = 9)


Any suggestions?

Thanks in advance
 

Hi,

"Select everything from tableA where txtBID = '9' "

does not make sense.

"These two tables are not related.."

If they are NOT related, then they are NOT related. So why are you trying to do something that only relates to related tables?

Skip,

[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue]
 
Something like this ?
SELECT A.*
FROM TableA AS A INNER JOIN TableB AS B
ON A.numAge=B.numAge AND A.txtCityName=B.txtCityName AND A.txtState=B.txtState
WHERE B.txtBID='9'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top