0% found this document useful (0 votes)
7 views

My Query

query

Uploaded by

cderodriguez389
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

My Query

query

Uploaded by

cderodriguez389
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

SELECT sk_tienda

, sk date
, job_id
, item_id
, name
, origin
, state
, price
, currency_code
, original_quantity
, found_quantity
, is_substitute
, item_replaced_by_id
, replaced_by
, comment
, sku
, category
, insert_timestamp
, insert_audit_id
, process_run_date
FROM edw.edw.fact_il_sales_item LIMIT 10000;

select a.name,count(distinct job_id) as ordenes from edw.fact_il_sales_item a where


category='Special Product'

group by a.name
select distinct(comment) from edw.fact_il_sales_item a where upper(a.name)='Queso
cremoso'

select a.name,count(distinct job_id) as ordenes from edw.fact_il_sales_item a where


found_quantity=0

group by a.name

select a.name,count(distinct a.job_id) as ordenes, count(distinct sk_cliente) from


edw.fact_il_sales_item a

inner join edw.fact_il_sales using(job_id) where found_quantity=0

group by a.name

select a.name,count(distinct a.job_id) as ordenes, count(distinct sk_cliente),


a.sk_il_tx_date, category from edw.fact_il_sales_item a

inner join edw.fact_il_sales using(job_id) where found_quantity=0 and


(a.sk_il_tx_date >='20210901')

group by a.name, a.sk_il_tx_date, category

select a.name,count(distinct a.job_id) as ordenes, count(distinct sk_cliente),


a.sk_il_tx_date, a.sk_tienda,category from edw.fact_il_sales_item a
inner join edw.fact_il_sales using(job_id) where found_quantity=0 and
(a.sk_il_tx_date >='20220101')

group by a.name, a.sk_il_tx_date, category, a.sk_tienda

select a.name,count(distinct job_id) as ordenes, a.sk_il_tx_date from


edw.fact_il_sales_item a where category='Special Product' and (a.sk_il_tx_date
>='20210901')

group by a.name, a.sk_il_tx_date, category

You might also like