richrock Posted April 24, 2008 Share Posted April 24, 2008 Hi, I'm having a noob day and can't suss out what should be a simple problem... SELECT * FROM bid_auctions LEFT JOIN bids ON bids.userid WHERE bids.userid = ".$usrid." Returns information from two tables, which is getting all the info I need. However, in both tables there is an 'id' row. I need to get only the id numbers from bid_auctions not bids. How??? I am completely stumped. ??? Quote Link to comment Share on other sites More sharing options...
fenway Posted April 24, 2008 Share Posted April 24, 2008 You can't... * isn't psychic. You'll need to alias one of the id fields. BTW, you should really name your PK bid_id and user_id... that way, both the PK and FK have the same name, and you won't ever have name collisions. Quote Link to comment Share on other sites More sharing options...
richrock Posted April 25, 2008 Author Share Posted April 25, 2008 Sorry for sounding a little dull (this is my first project after all)... What are PK and FK? I get the whole thing about aliases. Guess this is going to be a long string, as there's quite a lot of info to be extracted from these tables... Thanks Quote Link to comment Share on other sites More sharing options...
fenway Posted April 25, 2008 Share Posted April 25, 2008 Primary Key and Foriegn Key. Quote Link to comment Share on other sites More sharing options...
aschk Posted April 25, 2008 Share Posted April 25, 2008 I'll point you to the area of fault: "...JOIN bids >>> ON bids.userid <<< WHERE..." ON what? bids.userid IS TRUE, = "darth vader", has rare unconditioned tropical disease? I'll leave it for you to figure out p.s. simple tip: join on something Quote Link to comment Share on other sites More sharing options...
fenway Posted April 25, 2008 Share Posted April 25, 2008 I'll point you to the area of fault: "...JOIN bids >>> ON bids.userid <<< WHERE..." ON what? bids.userid IS TRUE, = "darth vader", has rare unconditioned tropical disease? I'll leave it for you to figure out p.s. simple tip: join on something Yeah, that too... but the * issue still applies. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.