Skip to content

Instantly share code, notes, and snippets.

@diana-shealy
Created April 7, 2016 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diana-shealy/dcc6b0e773541d830c1d1fd1bfb984db to your computer and use it in GitHub Desktop.
Save diana-shealy/dcc6b0e773541d830c1d1fd1bfb984db to your computer and use it in GitHub Desktop.
Joining the testing data with store information
INSERT OVERWRITE TABLE testing2
SELECT
rowid() as rowid,
t1.id,
t1.stateholiday, t1.store, t1.promo, t1.dayofweek, t1.date, t1.schoolholiday,
SUBSTR(t1.date,1,4) as year,
SUBSTR(t1.date,6,2) as month,
SUBSTR(t1.date,9,2) as day,
t2.promo2sinceweek,
t2.competitionopensinceyear,
t2.assortment,
t2.promo2sinceyear,
t2.competitiondistance,
t2.promointerval,
t2.promo2,
t2.storetype,
t2.competitionopensincemonth
FROM
test_original t1
JOIN store_raw t2 ON (t1.store = t2.store);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment