Support Questions

Find answers, ask questions, and share your expertise

please explain how does this join work

avatar
Explorer

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

avatar

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!!

View solution in original post

1 REPLY 1

avatar

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!!