Answers for "Subquery Vs CTE1.1"

SQL
0

Subquery Vs CTE1.1

SELECT 
  cat_name, 
  max_pet_date 
FROM cat_dim
LEFT JOIN  (
  SELECT
  	cat_id, 
  	MAX(timestamp)::DATE AS max_pet_date,
    MIN(timestamp)::DATE AS min_pet_date 
  FROM cat_pet_fact
  GROUP BY cat_id
) AS avg_pet_count_over_time
ON cat_dim.cat_id = avg_pet_count_over_time.cat_id;
Posted by: Guest on July-17-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language