i have two tables,
a) albums
b)pictures
i am using the following query to select the albums.id, albums.cover_picture_id, pictures.url where albums.cover_picture_id = pictures.id, i want to perform the following
select all the values from albums
, but it should also fetch the pictures.url with reference to albums.cover_picture_id
for the purpose i am using the following SELECT STATEMENT
SELECT
albums.id,
albums.cover_picture_id,
pictures.url
FROM albums
JOIN pictures
ON
(
albums.cover_picture_id = pictures.id
)
it works fine but i have a problem here, the table entity albums.cover_picture_id may contain the value 0 which does not exist in pictures.id so it will not fetch the value if it finds 0, i would want to fetch all the albums from the albums table even if it finds 0. how do i add the clause in the select statement.
thank you