Hey guys,
Im far from an SQL expert, I know the occasional inner join and so on, but for this one I need some help. Code is classic ASP.

What I currently have is a dropdown onscreen that allows users to show "all advertisements" OR "all with photos".

Im wanting to know how it would be possible to write this query...?

DB is MS SQL 2000

strSQL = "SET DATEFORMAT DMY; SELECT S.* FROM tbladverts AS S WHERE S.adverts_status = 1"

*** SQL QUERY is constructed in accordance with user dropdown form selections....

ad_types = Request("ad_types")

if ad_types = "1" then
'display ALL ad types ' do nothing
elseif ad_types = "2" then
'display ads with photos only
strSQL = strSQL & " AND ....... *get photos*"
end if

Photos are stored in the tblphotos table.

The relationship is as follows...

tbladverts -> tblphotos (tblph_advertID - which matches the tbladverts PK)

How is this doable?

In english ...

elseif ad_types = "2" then
'display ads with photos only
strSQL = strSQL & " AND get me all ads within the tbladverts table that have a related entry in the tblphotos table"

Make sense?

Thanks guys,

John