add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table Vehicle_parts (vehicle_id int, Vehicle_Major_Part_Number varchar(200),
Vehicle_Sub_Part_Number varchar(200));
insert into Vehicle_parts values (1,'11111 xxx','22222 xxx');
insert into Vehicle_parts values (2,'33333 zzz','11111 yyy');
insert into Vehicle_parts values (3,'44444 aaa','22222 bbb');
insert into Vehicle_parts values (4,'22222 zzz','11111 yyy');
insert into Vehicle_parts values (5,'88888 zzz','44444 yyy');
5 rows affected
SELECT vehicle_id, vehicle_major_part_number, vehicle_sub_part_number
FROM vehicle_parts
WHERE '11111 xxx' IN (vehicle_major_part_number, vehicle_sub_part_number)
OR '88888 zzz' IN (vehicle_major_part_number, vehicle_sub_part_number);
vehicle_id vehicle_major_part_number vehicle_sub_part_number
1 11111 xxx 22222 xxx
5 88888 zzz 44444 yyy
SELECT vehicle_id, vehicle_major_part_number, vehicle_sub_part_number
FROM vehicle_parts
WHERE CONCAT(vehicle_major_part_number, vehicle_sub_part_number)
LIKE '%11111%' OR
CONCAT(vehicle_major_part_number, vehicle_sub_part_number) LIKE '%88888%';
vehicle_id vehicle_major_part_number vehicle_sub_part_number
1 11111 xxx 22222 xxx
2 33333 zzz 11111 yyy
4 22222 zzz 11111 yyy
5 88888 zzz 44444 yyy
SELECT vehicle_id, vehicle_major_part_number, vehicle_sub_part_number
FROM vehicle_parts
WHERE vehicle_major_part_number LIKE '11111%'
OR vehicle_major_part_number LIKE '88888%'
OR vehicle_sub_part_number LIKE '88888%'
OR vehicle_sub_part_number LIKE '11111%';
vehicle_id vehicle_major_part_number vehicle_sub_part_number
1 11111 xxx 22222 xxx
2 33333 zzz 11111 yyy
4 22222 zzz 11111 yyy
5 88888 zzz 44444 yyy