Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

please explain how does this join work

SOLVED Go to solution
Highlighted

please explain how does this join work

New Contributor

Hi Guys,

can someone please explain how does the below join work in the bottom query. Its from thisl tutorial. I don't get the bit after "concat". thanks

ON o.swid = concat('{', u.swid ,'}');
CREATE TABLE webloganalytics as
SELECT to_date(o.ts) logdate, o.url, o.ip, o.city, upper(o.state) state,
o.country, p.category, CAST(datediff(from_unixtime(unix_timestamp()), from_unixtime(unix_timestamp(u.birth_dt,'dd-MMM-yy')))/365 AS INT) age, u.gender_cd
FROM omniture o
INNER JOIN products p
ON o.url = p.url
LEFT OUTER JOIN users u 
ON o.swid = concat('{', u.swid ,'}');
1 ACCEPTED SOLUTION

Accepted Solutions

Re: please explain how does this join work

Guru

Hi @Harjinder Brar

concat('{', u.swid ,'}') will concatenate bracs with the value from u.swid. For Example if the value of u.swid is TEST then it will be converted to {TEST} which will be used to join with o.swid column. Hope it Helps!!

1 REPLY 1

Re: please explain how does this join work

Guru

Hi @Harjinder Brar

concat('{', u.swid ,'}') will concatenate bracs with the value from u.swid. For Example if the value of u.swid is TEST then it will be converted to {TEST} which will be used to join with o.swid column. Hope it Helps!!