SQL Join Statement

Posted by mouthpiec on Stack Overflow See other posts from Stack Overflow or by mouthpiec
Published on 2010-05-04T12:08:18Z Indexed on 2010/05/04 13:18 UTC
Read the original article Hit count: 323

Filed under:
|
|

Hi

I have the following SQL SELECT statement

SELECT bar_id, bar_name, town_name, advert_text     
FROM bar, towns, baradverts
WHERE town_id = town_id_fk
AND bar_id = bar_id_fk

My problem is that since not every bar has an advert in table "baradverts", these bars are not coming up in the results. In other words I need a NULL for those bars that do not have an advert string.

© Stack Overflow or respective owner

Related posts about sql

Related posts about select