Quantcast
Channel: Active questions tagged cte - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 207

Help with CTE syntax in SQL

$
0
0

I am new to SQL, I tried to create a CTE, but I get a red squiggle under the AS and I am getting an error message in the process of executing the syntax:

Msg 102, Level 15, State 1, Line 117 Incorrect syntax near ')'.

This is the SQL syntax, any help would be great:

WITH CTE_Grand_Harvest_Total AS (SELECT     zardi, COUNT(zardi) AS Count_ZARDI, SUM(Weight) AS Sum_Weight, Total_Harvest, Total_Harvest*COUNT(zardi)*SUM(Weight) AS Grand_TotalFROM     S1_PH_CROPS_clean_final_minus_money_mattersWHERE      Work.dbo.S1_PH_CROPS_clean_final_minus_money_matters.cropNamePH = 'Maize'GROUP BY     Total_Harvest, zardi)

Viewing all articles
Browse latest Browse all 207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>