Can someone please help, I'm looking for the SQl (for SQL server to do the following): (it should be easy but its not proving that way!)
2 tbls: News_Article_Pictures & News_Articles
The News_Article_Pictures tbl contains the following fields:
PictureID (int(4) (incremental)
Picture_Title (varchar (80))
Picture_Filename (varchar (80))
DateAdded nVarchar (12)
Picture_Description (text)
News_Articles tbl:
ArticleID (int(4) increment
ArticleTitle (varchar (80))
ArticleText text
PictureID (int (4)
ArticleDatePosted nVarchar (12)
ArticleKeywords (varchar (80))
My tables obviously link on PictureID, what I want to be able to do is return the PictureID's from the News_Article_Pictures tbl WHERE there is no match in the News_Articles tbl.
I have tried what I thought would be the SQL but it returns no records:
SELECT TOP 100 PERCENT dbo.News_Article_Pictures.PictureID, dbo.News_Article_Pictures.Picture_Title, dbo.News_Article_Pictures.Picture_FileName,
dbo.News_Article_Pictures.DateAdded, dbo.News_Article_Pictures.Picture_Description
FROM dbo.News_Article_Pictures INNER JOIN
dbo.News_Articles ON dbo.News_Article_Pictures.PictureID = dbo.News_Articles.PictureID AND
dbo.News_Article_Pictures.PictureID <> dbo.News_Articles.PictureID
ORDER BY dbo.News_Article_Pictures.PictureID
I have tried lots of different combinations, but nothing works what am i doing wrong?
Thanks alot..
2 tbls: News_Article_Pictures & News_Articles
The News_Article_Pictures tbl contains the following fields:
PictureID (int(4) (incremental)
Picture_Title (varchar (80))
Picture_Filename (varchar (80))
DateAdded nVarchar (12)
Picture_Description (text)
News_Articles tbl:
ArticleID (int(4) increment
ArticleTitle (varchar (80))
ArticleText text
PictureID (int (4)
ArticleDatePosted nVarchar (12)
ArticleKeywords (varchar (80))
My tables obviously link on PictureID, what I want to be able to do is return the PictureID's from the News_Article_Pictures tbl WHERE there is no match in the News_Articles tbl.
I have tried what I thought would be the SQL but it returns no records:
SELECT TOP 100 PERCENT dbo.News_Article_Pictures.PictureID, dbo.News_Article_Pictures.Picture_Title, dbo.News_Article_Pictures.Picture_FileName,
dbo.News_Article_Pictures.DateAdded, dbo.News_Article_Pictures.Picture_Description
FROM dbo.News_Article_Pictures INNER JOIN
dbo.News_Articles ON dbo.News_Article_Pictures.PictureID = dbo.News_Articles.PictureID AND
dbo.News_Article_Pictures.PictureID <> dbo.News_Articles.PictureID
ORDER BY dbo.News_Article_Pictures.PictureID
I have tried lots of different combinations, but nothing works what am i doing wrong?
Thanks alot..