I am trying to create a select statement and filter out some Locations, I have store locations with names, i.e.
"Alpha"
"Beta"
"Gamma"
And I have Warehouse Locations whose names begin with Warehouse, i.e.
"Warehouse 1"
"Warehouse 2"
"Warehouse 3".
I am trying to have a select statement to filter out all the warehouses EXCEPT 'Warehouse 35', is this possible? Or the only way is to exclude warehouse by warehouse?
Current Query:
SELECT * FROM Locations where LocationName not like ('Warehouse%')
答案 0 :(得分:2)
You can combine alternate filters with OR, e.g. to select Warehouse 35 and everything that doesn't start with Warehouse:
SELECT *
FROM Locations
WHERE LocationName = 'Warehouse 35' OR LocationName NOT LIKE 'Warehouse%';
Or in programming is generally inclusive, i.e. A or B is true if A is true, B is true, or both are true.
答案 1 :(得分:0)