You can do this in 3 methods.
Method 1:
Using CASEStatement:
select
(case when Barcode = '7630015711115'
then BarcodeAlternatief
else Barcode END) as 'Barcode'
from ArtikelAlternatief
where Barcode = '7630015711115'
or BarcodeAlternatief = '7630015711115';
Method 2:
You can try using the DECODE(Ofacle) operator ,
SELECT DECODE (BarcodeAlternatief , '7630015711115', Barcode , BarcodeAlternatief ) AS Barcode
FROM dbo.ArtikelAlternatief
where Barcode = '7630015711115' OR BarcodeAlternatief = '7630015711115'
Method 3:
Try the query with UNION ALL:
select BarcodeAlternatief AS 'Barcode' from dbo.ArtikelAlternatief
where Barcode = '7630015711115'
UNION ALL
select Barcode AS 'Barcode' from dbo.ArtikelAlternatief
where BarcodeAlternatief = '7630015711115'
- If you want to allow duplicates, use
UNION ALL. If you do not want to allow duplicates, use UNION. = LIKE, , .