Jump to content

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/

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.