Jump to content

join with incomplete data problem


richrock

Recommended Posts

Hi all,

 

I'm trying to retrieve information in a single mysql command to generate information for a pdf file.  This requires a total list of items in a sale, and also displayed alongside will be offers made prior the sale.

 

I have two tables, one has around 200 items, called bid_auctions, and the other called bids.  bid_auctions has an entry called bid_offer, and simply indicates 0 or 1, depending on whether the item has (1) or hasn't (0) had a bid placed on it.  the second table (bids) has information such as bid_amount, bid_id (the id number from bid_auctions).

 

I need to list all items, and if they have a bid, list that info too.  I can't seem to find any info about joining where there is an 'if' statement, eg join bids if bid.id_offer = bid_auctions.id....

 

Help  :-[

 

Update: I've found that I can do if in mysql, however, can't figure out how to do an if.. join statement...

Link to comment
https://forums.phpfreaks.com/topic/133471-join-with-incomplete-data-problem/
Share on other sites

for that, you would need a full outer join. but, i went to go look up the syntax for mysql and it seems it doesn't support full outer joins. another google search turned up this tutorial on how to 'simulate' it though. Hope it helps:

http://www.xaprb.com/blog/2006/05/26/how-to-write-full-outer-join-in-mysql/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.