CoolaSQL provides the ability to run server side join. Server side join is useful when you need to either join two or more queries, or CoolaData and a custom table.
CoolaSQL supports the following JOIN types:
- JOIN
- INNER JOIN
- LEFT JOIN
- LEFT OUTER JOIN
- RIGHT JOIN
- RIGHT OUTER JOIN
Note: Make sure to provide aliases to all data columns in the top select when performing a join.
Example: Using INNER JOIN
SELECT a.ip_country AS country ,a.sessions AS current_week_sessions ,b.sessions AS previous_week_sessions FROM ( SELECT ip_country ,count(session_id) AS sessions FROM cooladata WHERE date_range(CURRENT WEEK) GROUP BY ip_country ) a INNER JOIN ( SELECT ip_country ,count(session_id) AS sessions FROM cooladata WHERE date_range(PREVIOUS WEEK) GROUP BY ip_country ) b ON a.ip_country = b.ip_country