I have 2 web sites and i am sending all the GA data into Big Query. Since Big Query would create different tables for each site, i would like to merge them into one. Also i would like to create a record to indicate the site's name so that site A and Site B data won't be mixed.
Is this possible? I have tried union, it works fine but just the i am not able to differentiate the data between site a and site b.
Appreciated Thanks
Assuming schemas identical:
SELECT * FROM
(SELECT *, 'siteA' AS site FROM TableA),
(SELECT *, 'siteB' AS site FROM TableB)
you should use [ ] when using fully qualified table name - project:dataset.table
SELECT * FROM
(SELECT *, 'siteA' AS site FROM [ga:123.ga_sessions_20160502]),
(SELECT *, 'siteB' AS site FROM [ga:456.ga_sessions_20160501])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With