Is it possible to accommodate the following conditions in one condition?

select count(*) from `order_delivery_address` where `order_delivery_address_city` != 'Липецк' and `order_price` <= 333 

So that at a price of less than 333, even under the condition that the city = Lipetsk, the line got into the sample? Those. if the second condition is satisfied, the first is ignored.

  • one
    Why not remove the condition checking the city for NOT Lipetsk at all? - Mike
  • Because in this sample I want to get a list of orders that do not contain specific cities, but if the price does not satisfy the condition in these orders, even if the city is from a list that I don’t want to see, then you still need to withdraw the order. - cruim
  • Those. You want to get any prices for cities that are not on the list, but if the price is less than 333 then all cities? But then you need to use OR instead of AND - Mike
  • @Mike something in the evening is really bad for me with logic, it's really simple or appropriate (apparently, the negation in the condition was knocked down). thank. - cruim

1 answer 1

So that at a price of less than 333, even under the condition that the city = Lipetsk, the line got into the sample?

 where NOT (order_delivery_address_city = 'Липецк' and order_price > 333) 

?