Using the code below, I am getting a count of 7 instead of 6 which is what I'm expecting. Can anyone tell me where 7 is coming from? Prod_Cat Ord_no entered_dt 502 00119544 20110217 511 00119558 20110217 511 00119565 20110217 511 00119567 20110217 506 00119568 20110217 511 00119569 20110217 NULL 00119570 20110217 502 00119570 20110217 511 00119570 20110217 512 00119570 20110217 NULL 00119572 20110217 502 00119572 20110217 501 00119574 20110217 502 00119574 20110217 502 00119575 20110217 505 00119576 20110217 502 00119577 20110217 511 00119577 20110217
select oeordlin_sql.prod_cat, count(distinct oeordlin_sql.ord_no),oeordhdr_sql.entered_dtfrom oeordlin_sql join oeordhdr_sql on oeordlin_sql.ord_type = oeordhdr_sql.ord_type andoeordlin_sql.ord_no = oeordhdr_sql.ord_nowhere oeordlin_sql.prod_cat = '511' and oeordhdr_sql.entered_dt = '20110217'group by prod_cat, entered_dt