help with SQL query
Posted on 2011-03-17
Hello, thank you for helping me with this MSSQL problem:
Table Cities: CITYNAME, CITYOPEN (1 means it is open, 0 means it is closed)
Table USERS: USERID, City
What I want to do is, given a USERID, say userID 1002, I want to run a check to see if any of that user's cities are closed. So if USERID 1002 has even a single closed city, then return "CLOSED + CITY NAME(s)", otherwise "OPEN"
How can I do this in a SQL statement?
1000 = OPEN
1001 = OPEN
1002 = CLOSED ATLANTA