Using INNER JOIN in MySQL
To create an INNER JOIN in MySQL look at the following code :-
$result = mysql_query("SELECT au.username FROM auction_users au INNER JOIN auction_bids ab ON au.member_id = ab.member_id WHERE auction_id=$id ORDER BY bid_amount DESC");

$result = mysql_query("SELECT * FROM auction_users au INNER JOIN auction_bids ab ON au.member_id = ab.member_id WHERE auction_id=$id ORDER BY bid_amount DESC");


The above code displays the username of the bidder from the users table, by joining the member.id in both auction_users and auction_bids tables.

I can see this being applied to other projects I do in the future.
Home - Apache - Ubuntu - MySQL - PHP - Misc

The Ubuntu Counter Project - user number # 17415
Updated on: 2008-01-08 07:23:10