Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created February 5, 2013 17:48
Show Gist options
  • Select an option

  • Save shofetim/4716205 to your computer and use it in GitHub Desktop.

Select an option

Save shofetim/4716205 to your computer and use it in GitHub Desktop.
SELECT
o.id AS "Order Number",
o.order_date AS "Order Date",
o.invoice_date AS "Invoice Date",
o.cached_post_shipped_invoiced_total AS "Amount",
CASE o.order_status
WHEN 1 THEN 'In Cart'
WHEN 2 THEN 'Resumed'
WHEN 3 THEN 'Placed'
WHEN 4 THEN 'Queued'
WHEN 5 THEN 'Picking'
WHEN 6 THEN 'Picked'
WHEN 8 THEN 'Shipped'
ELSE 'Unknown'
END AS "Status"
FROM customers_customer AS c
LEFT OUTER JOIN orders_order AS o
ON c.id = o.customer_id
WHERE c.customer_number = 946040
LIMIT 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment