Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Basic questions about purchasing orders.
-- When did these orders occur ?
-- How many records are there?
-- How many orders are there?
select
min(duedate) as min_duedate,
max(duedate) as max_duedate,
count(*) as num_records,
count(distinct purchaseorderid) as num_orders
from purchasing.purchaseorderdetail;
-- looks like purchaseorderheader has the actual order date
select
min(orderdate) as min_orderdate,
max(orderdate) as max_orderdate,
count(*) as num_records,
count(distinct purchaseorderid) as num_orders
from purchasing.purchaseorderheader;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment