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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is up with my query? Please help!

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
I have a query command

Code:
SELECT a . * , b . * FROM potable a, uctable b WHERE b.UsrID = 1 AND a.poCstID = b.ucCstID AND `poBranch` = 'MIA' ORDER BY poID LIMIT 0, 20

In this particular case poCstID = 3 and so does ucCstID. Fields are defined as int(9) in both tables.

I am getting an empty query. If I change the query to

Code:
SELECT a . * , b . * FROM potable a, uctable b WHERE b.UsrID = 1 AND a.poCstID = 3 AND `poBranch` = 'MIA' ORDER BY poID LIMIT 0, 20

--> NOTICE I simply a number 3 in lieu of b.ucCstID

I get the expected results ... What is up with that?

Your assistance will be truly appreciated.


 
dump the rows that you think are involved from each table and let's have a look at the data

you've shown us two queries and asked why they return what they return

the answer is: because that's what's in the tables



r937.com | rudy.ca
 
r937,

After walking away for a couple of hours and taking a second look, I confirmed what you stated, "because that is what the table has ...".

I totally missed the fact that one of the table did not have matching record - I had the wrong DB opened on one of the pages I flipped in/out of ...

Thanks,


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top