Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.74 KB | None | 0 0
  1. -- inserted, non-deleted orders which have an order flag that they have no right to!
  2. select * from orders where inserted and deleted_at is null and order_flag_id in (1, 2, 9, 10, 16, 17, 19, 20, 21, 22, 23, 24, 25) and profit_margin not between 0 and 14.99
  3. union all
  4. select * from orders where inserted and deleted_at is null and order_flag_id in (3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32) and profit_margin > -1
  5. union all
  6. select * from orders where inserted and deleted_at is null and order_flag_id = 34 and profit_margin > 0 and sell_total <> 0
  7. union all
  8. select * from orders where inserted and deleted_at is null and order_flag_id in (35, 36) and sell_total < 0.01 and cost_total < 0.01;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement