Hi,
I have a table in which there are two columns. One column is id and the other is value. When I try to retrieve the data that is not empty it gives me unwanted error. I have to apply join to some tables as well. My query is something like this SELECT count(DISTINCT ID) FROM Tbl inner join tbl1 on tbl.id=tbl1.id WHERE id IN(1,2,3) and value!=''.But it also resturns the values that are empty. Can anyone help. Thanks in advance.
saadi06
2
Junior Poster in Training
Recommended Answers
Jump to PostDo you have any NULL values in your database? Because then you would have to append "AND value IS NOT NULL" to your query :).
Jump to PostSELECT count(DISTINCT ID) FROM Tbl inner join tbl1 on tbl.id=tbl1.id WHERE id IN(1,2,3) and value!=''
You don't specify the tables in the where clause. Or in the count part. I don't think the count stuff will work
count(DISTINCT ID)
All 7 Replies
minitauros
151
Junior Poster
Featured Poster
diafol
saadi06
2
Junior Poster in Training
diafol
TomH.PG
1
Newbie Poster
saadi06
2
Junior Poster in Training
saadi06
2
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.