SQL: different amount of data -
i have two-step task @ hand: first, join should performed:
select * [my_table2]b left join [my_table3]c on (b.customer_pk=c.customer_pk) c.customer_pk null
that worked , gave me 2985 rows needed next step (to verify received data appear in table:
select * [my_table1]a a.customer_id in (select b.customer_id [my_table2]b left join [my_table3]c on (b.customer_pk=c.customer_pk) c.customer_pk null)
for reason, gave me bit more lines - 2996 (same result when distinct used column names). however, when try find out - means of except (no minus supported) 11 rows (i need receive 1 column identical in tables in terms of data type - decimal (9, 0)), no results. idea goes wrong? here's third query:
select customer_id [my_table1]a a.customer_id in (select b.customer_id [my_table2]b left join [my_table3]c on (b.customer_pk=c.customer_pk) c.customer_pk null) except select customer_id [my_table2]b left join [my_table3]c on (b.customer_pk=c.customer_pk) c.customer_pk null
thanks!
one or more of customer_id
s first select have more 1 record corresponding customer_id
in [my_table1]
.
to find out ids duplicates, use this
select a.customer_id, count(*) [my_table1]a left join [my_table2]b on (a.customer_id = b.customer_id) left join [my_table3]c on (b.customer_pk = c.customer_pk) c.customer_pk null group a.customer_id having count(*) > 1
Comments
Post a Comment