You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our current approach for data ingestion suggests importing data on a daily basis with the full load. It means that to query data from such tables, I need to use filters to get data with max load_date. I've included an example of such a query below. As you can see, it's hard to read and maintain. Could you please advise how I can use query snippets in Redash to enable data analysts to filter data for max load_date in a more convenient way?
SELECT t1.id,
t1.column1 AS FXE_Number,
CAST(date_format(t1.column2, '%Y-%m-%d %H:%i:%s') AS varchar) AS Creation_Date,
t1.column3 AS Email_Subject,
CAST(date_format(t1.column4, '%Y-%m-%d %H:%i:%s') AS varchar) AS Close_Date,
t1.column5 AS Sender_ADDRESS,
t2.column6 AS Category_Title,
t3.column7 AS Activity,
t4.login_name,
t5.name AS State,
Floor(date_diff('day', t1.column2, t1.column4)) AS AHT_day
FROM test_table1 t1
LEFT JOIN test_table2 t2 ON t1.column8 = t2.request AND date(t2.column9) = (SELECT MAX(date(column9)) FROM test_table2)
LEFT JOIN test_table3 t3 ON t1.column10 = t3.id AND date(t3.column11) = (SELECT MAX(date(column11)) FROM test_table3)
LEFT JOIN test_table4 t4 ON t1.column12 = t4.id AND date(t4.load_date) = (SELECT MAX(date(load_date)) FROM test_table4)
LEFT JOIN test_table5 t5 ON t1.column13 = t5.id AND date(t5.load_date) = (SELECT MAX(date(load_date)) FROM test_table5)
WHERE t1.column4 BETWEEN TIMESTAMP '2023-02-10' AND TIMESTAMP '2023-02-12'
ORDER BY t1.id DESC;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
Our current approach for data ingestion suggests importing data on a daily basis with the full load. It means that to query data from such tables, I need to use filters to get data with max load_date. I've included an example of such a query below. As you can see, it's hard to read and maintain. Could you please advise how I can use query snippets in Redash to enable data analysts to filter data for max load_date in a more convenient way?
Beta Was this translation helpful? Give feedback.
All reactions