sql - Select returns the same row multiple times -


i have following problem:

in db, have 2 tables. value 1 column in first table can appear in 2 different columns in second one.

so, configuration follows:

table_a: column print_group table _b: columns print_digital , print_offset

the value different rows , print_group column of table_a can appear in 1 row of table_b in different column.

i have following query:

select distinct * table_a  inner join  b on (table_a. print_digital = table_b.print_group or  table_a.print_offset = table_b.print_group) 

the problem query returns same row table_a 2 times.

what doing wrong? right query?

thank help

if i'm understanding question correctly, need clarify fields come table_a:

select distinct a.*  table_a      inner join b on a.print_digital = b.print_group         or a.print_offset = b.print_group 

edit:

given comments, looks need select distinct b.*

select distinct b.*  table_a      inner join b on a.print_digital = b.print_group         or a.print_offset = b.print_group 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -