Ditutup

Convert Redshift SQL To Hive

Convert following redshift SQL query to hive

with base as ( select [login to view URL]

,fcs.campaign_code||' : '||fcs.campaign_start_date||' : wk'||fcs.campaign_week_nbr||' then ' as cmp

,sum(bss.tot_sales_incld_gst-bss.tot_wow_dollar_incld_gst) as spend

from loyalty_bi_analytics.fact_campaign_sales fcs

left join loyalty.lylty_card_detail lcd

on fcs.crn=[login to view URL]

left join (select * from loyalty.basket_sales_summary where start_txn_date between '2019-10-07' and '2019-10-13') bss

on lcd.lylty_card_nbr=bss.lylty_card_nbr

where fcs.offer_start_date between '2019-10-07' and '2019-10-13'

and fcs.special_sales is NULL

and fcs.campaign_audience_type='T'

and fcs.redeem_flag is not NULL

group by 1,2

order by 1,2

)

,listy as ( select cmp

,row_number() over (order by cmp)

from base

group by 1

)

,agg as ( select [login to view URL]

,[login to view URL]

,listagg([login to view URL]) within group (order by [login to view URL], [login to view URL]) as path

-------------------------------------^^^

,count([login to view URL]) as pathorder

from base

left join listy

on listy.cmp=[login to view URL]

group by 1,2

)

,spendtab as ( select path

,pathorder

,count(crn) as records

,sum(spend) as sum_spend

from agg

group by 1,2

)

CREATE TABLE customer_spend_table

USING PARQUET

select *

from spendtab

Kemahiran: SQL, Hive, Redshift

Lihat lagi: convert access database to sql, convert ms access to sql server, convert .sql to .db online, convert sql to xls online, convert xml column to table sql server, convert sql to natural language, convert ms access sql to oracle sql, convert a sql query result table to an html table for email, convert oracle sql to ansi online, sql to hive converter online, convert t-sql to pl/sql, convert sql to firebase, convert access sql to sql server, convert ms sql to mysql online, convert oracle sql to postgresql online, convert access sql to sql, convert pl sql to javascript, sql to hive query converter, convert pl sql to t sql, convert access sql to tsql

Tentang Majikan:
( 30 ulasan ) Seattle, United States

ID Projek: #22824183

3 pekerja bebas membida secara purata $27 untuk pekerjaan ini

desiresky

Gone through the Description,Hire me to expect periodic updates and professionalism .Please trust and give a chance will not disappoint [login to view URL] me for further discussion.

$30 USD dalam sehari
(1 Ulasan)
1.7
sridharnaras

My name is Sridhar. I am living in japan and I have 8 years of experience. Currently working with one of the big insurance company. I am responsible in data distribution to the banks. I am mainly using COBOL, SQL, PLSQ Lagi

$30 USD dalam 20 hari
(0 Ulasan)
0.0
pabbi92

Hello. We are a team of freelancers with solid skills in our field. We are experienced programmers and Java developers. We are ready to work with you with high speed and quality. Looking forward to it. profiency in SQ Lagi

$20 USD dalam sehari
(0 Ulasan)
0.0