Hi there, I am a newbie to MSSQL. I apologise first as I know that my question might have been asked by others elsewhere but unfortunately I couldn't find it. I will really appreciate if someone can shed some light into my question.

I have two tables with the following fields respectively:

1. ProjectTABLE
projectid (int)
projectName (varchar)

2. photoTABLE
photoid (int)
projectid (int)
path (varchar)
approved (true or false)

I would like to retrieve the projectid, projectName, (path, where photoTABLE.approved=true), where projectid = @projectid

How can this be possibly done. How the SQL query should be written? Thanks.

8 Years
Discussion Span
Last Post by poojaabora

Hi you can use the following query.
declare approved as 'varchar'

select projectid,projectname,path from projecttable, phototable where projecttable.projectid= phototable.projectid and phototable.appoved like 'true'

Let me know if you face any problem with this query.


Hi there, thanks for the response. It solves my problem. I just realised from your post that what I need is the AND parameter :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.