My table have these data:
ID | company_id | code | description
01 | NULL | CD01 | Standard description CD01
02 | NULL | XYZU | Standard description XYZU
03 | 1 | CD01 | Custom description CD01 for company 1
04 | 2 | CD01 | Custom description CD01 for company 2
I need to extract all 'code' from this table but showing a single product code only once.
If exists a record witht company_id <> '' I show that, instead if doesn't exists I show the record with standard description.
Starting from the sample data, if I wanted to show the articles for the company_id = 1, I expect to have this output:
ID | company_id | code | description
02 | NULL | XYZU | Standard description XYZU
03 | 1 | CD01 | Custom description CD01 for company 1
Have you got some suggest to do it?
Thank you