J Joy83 Member Local time Today, 10:39 Joined Jan 9, 2020 Messages 116 Nov 21, 2022 #1 Hello, I have a field that contains the date in this format 201109 integer Each row includes cost and that field I want to build sql that gets me the the amounts by year? Last edited: Nov 21, 2022
Hello, I have a field that contains the date in this format 201109 integer Each row includes cost and that field I want to build sql that gets me the the amounts by year?
V Velocity New member Local time Tomorrow, 00:09 Joined Nov 8, 2022 Messages 7 Nov 21, 2022 #2 Code: SELECT SUM(cost) as total_cost FROM your_table WHERE date LIKE '%2011%'
E ebs17 Well-known member Local time Today, 19:39 Joined Feb 7, 2020 Messages 2,175 Nov 21, 2022 #3 SQL: SELECT your_Date \ 100 AS [year], SUM(cost) AS total_cost FROM your_table GROUP BY your_Date \ 100
SQL: SELECT your_Date \ 100 AS [year], SUM(cost) AS total_cost FROM your_table GROUP BY your_Date \ 100
S sonic8 AWF VIP Local time Today, 19:39 Joined Oct 27, 2015 Messages 1,408 Nov 21, 2022 #4 Joy83 said: I have a field that contains the date in this format 201109 integer Click to expand... You should explain the format. Without further explanation, the year could be 2020, 2011, or 2009 to name just the most plausible.
Joy83 said: I have a field that contains the date in this format 201109 integer Click to expand... You should explain the format. Without further explanation, the year could be 2020, 2011, or 2009 to name just the most plausible.