I need help with sequel query with INNER/OUTER JOIN
-
Hi, Here is the similar query, that I need:
SELECT News.NewsID, News.Headline, Images.ImageID FROM News INNER JOIN Images ON News.NewsID = Images.NewsID WHERE (News.Enabled = @Enabled) AND (Images.Favourite = @fave)
But this gives only those headlines that have there images, but I need all the headlines, and if they have images, then to get the favorite imageID, because they can have more than one image and only one of them is favorite. thx -
Hi, Here is the similar query, that I need:
SELECT News.NewsID, News.Headline, Images.ImageID FROM News INNER JOIN Images ON News.NewsID = Images.NewsID WHERE (News.Enabled = @Enabled) AND (Images.Favourite = @fave)
But this gives only those headlines that have there images, but I need all the headlines, and if they have images, then to get the favorite imageID, because they can have more than one image and only one of them is favorite. thxDo an outer join, so you get the columns you want, plus those where the image doesn't exist.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Do an outer join, so you get the columns you want, plus those where the image doesn't exist.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )