Selecting date from two tables

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
NiGHTFiRE
Forum Contributor
Posts: 156
Joined: Sun May 14, 2006 10:36 am
Location: Sweden

Selecting date from two tables

Post by NiGHTFiRE »

Hey,
i don't really know if it's the right topic name but i'll try to describe my problem.
I've got two tables, one is auction and one is bud.
One of the columns in auction is item and one of the columns in bud is item as well.
I do a php statement to select everything from auction. And i list all data in my script.
Then i gotta select everything from bud where the data is from the auction column item.

I you don't understand please tell me and i'll try to tell you better.
Thanks
GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post by GM »

Sounds like you need to join the tables. Use something like:

Code: Select all

SELECT a.fielda1, a.fielda2 ... b.fieldb1, b.fieldb2
FROM Auction a, Bud b
WHERE a.item = b.item
Post Reply