Re: 2 Query with same criteria giving different number of rows

2003-10-22 Thread Illyes Laszlo
Hi! Think about using DISTINCT and COUNT together. I don't think it is a best coice. But maybe I'm wrong. Please Paul Dubois make your point. regards On Wed, 22 Oct 2003 13:25:20 -0400, Hector Del Curto wrote > I have this 2 queries: > > SELECT COUNT(DISTINCT(LEFT(p.prod_num,5))) FROM products

Re: 2 Query with same criteria giving different number of rows

2003-10-22 Thread Chris Tucker
You're getting a distinct on just the prod_num in the first query, but are requesting distinct prod_num, description, line, and content in the second one: if any of those last three columns are different between rows, you will see ones additional to the count you get in the first query. You ei

2 Query with same criteria giving different number of rows

2003-10-22 Thread Hector Del Curto
I have this 2 queries: SELECT COUNT(DISTINCT(LEFT(p.prod_num,5))) FROM products p, tlines l, prod_line pl WHERE l.Line = 'Solaris' AND l.id=pl.line_id AND pl.prod_id = p.id_product SELECT DISTINCT(LEFT(p.prod_num,5))as prod_num, p.description AS description,l.Line as line,l.Content as content FRO