Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select c.id as id,
  2.        coalesce(c.brand, p.brand) as brand,
  3.        coalesce(c.name, p.name) as name,
  4.        p.api_url,
  5.        c.code as code,
  6.        coalesce(c.price, p.price * (100 - c.discount) / 100) as price,
  7.        p.type as type,
  8.        p.subtype as subtype,
  9.        coalesce(c.period, p.period) as period,
  10.        c.ttl as ttl,
  11.        p.schema as schema
  12.   from product p
  13.        join campaign c on (c.product=p.id)
  14.  where c.not_before <= now()
  15.        and c.not_after > now();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement