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_ids 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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -