I have a sql query that queryies tables from different instances, I thought I had this issue resolved using this " Select Count(*) from SIMS where SIMS_ID in" however when i did a little further checking I realized it wasn't returning what I thought
I thought it was checking to see if the table was empty or not, if it was empty then it would just return the "Else '0' at the end of my sql query, However i just realized that it was returning the amount of rows in the table.
The query is supposed to return a value from the Designated_Amount table if it meets the Where statement criteria, if it doesn't it is supposed to return "0". The problem that I have is that the SIMS table does not have to have anything in it until
an event happens that causes the user to insert data, that could be next week or next year. In the meantime i have to be able to query the table and return some value.
How do I deal with queries against an empty table?
Here is my sql query: