Inner Join with repeated values

0

Good morning! Can anyone help me with a question?

I have a select

SELECT * FROM order 
INNER JOIN kn_status ON (kn_order.n_order = kn_status.fk_order)
WHERE kn_order.fk_cliente='$id'

The problem is that in the STATUS table the N_ORDER repeats several times and when I run WHILE it shows me the result of the repeated ORDER table.

    
asked by anonymous 23.05.2018 / 15:08

1 answer

1

Hello, David! This is a structural problem. If the n_order column will be related to another table's column, then it should be a single column (this is your goal). But if this is not the restriction, ie the n_order column can repeat, then use the value differentiation column. This column of differentiation is where it informs that one line is different from the other.

Good luck!

    
23.05.2018 / 15:19