Since your database server allows nested queries, why not use one single query?
1) I changed from "=" to "in" in the where clause; the select statement can theoretically return multiple rows so "in" should be used. "=" should be used when selecting a single record, like a MAX, AVERAGE, etc.
2) I didn't use an INNER JOIN because then all divsec records without a matching file_reg record wouldn't show up. The following should also work:
Just make sure to not use COUNT(*) or COUNT with any of the divsec table columns or the zeros will turn into ones.
Aditi agarwal wrote:Rob this query is not working its giving error
I see that I forgot to add "AS ef" just before "from divsec" in my first query. Without it the column is unnamed and you can't use named retrieval to get the value. But did you also try the second query I posted?
Joined: Feb 23, 2011
thanks Rob & swastik for your reply
actually it was a silly bracket mistake which i had commiteed
now its running fyn