orders table have billing state filed and shipping state field. I need to get orders which were shipped to NY state. Suppose an order was billed and shipped to NY state. In this case billing_state field has value NY and ship_state is null. One order was placed from CA and shipped to NY. billing_state value is CA and ship_state is NY. Now what should be the query to get both rows in result?
SELECT * FROM table WHERE (billing_state = NY and shipping_state = null) OR shipping_state = NY; Code (markup): This should work - however, storing the shipping state as "null" is just stupid - why not just store it as the same as billing state if those two are the same?