Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
gaby_58
Starting Member
33 Posts |
Posted - 2012-06-25 : 16:35:32
|
Hi all, Don't see anything wrong with this query, still it gives as incorrect syntax near GROUP, what is wrong here..thanks for any tips.conS3 = new SqlConnection(WebConfigurationManager.ConnectionStrings["test"].ConnectionString); conS3.Open(); cmdS3 = new SqlCommand("SELECT TOP 1 SupplierId, Supplier," + "SUM(TotalValue) FROM viewtest WHERE YEAR(YDate)='" + pRefYear.ToString() + "' AND " + strR + "Id IN(" + strId + ")AND SupplierId <>" + strSupplierId[0] + "AND SupplierId <>" + strSupplierId[1] + "AND SupplierId <>" + strSupplierId[2] + "GROUP BY SupplierId, Supplier ORDER BY SUM(TotalValue) DESC", conS3); |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
gaby_58
Starting Member
33 Posts |
Posted - 2012-06-25 : 16:58:31
|
Could you please give me an example for the above query? how to write parameterized query for the above types? |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
andersqwe
Starting Member
4 Posts |
Posted - 2012-06-25 : 17:05:47
|
Well it is hard to tell without seeing the parsed sql coukd you get this at runtime via the immediate window?Its me |
 |
|
andersqwe
Starting Member
4 Posts |
Posted - 2012-06-25 : 17:06:22
|
Well it is hard to tell without seeing the parsed sql coukd you get this at runtime via the immediate window?Its me |
 |
|
gaby_58
Starting Member
33 Posts |
Posted - 2012-06-26 : 09:57:25
|
Could you please give me the proper version for the above query i mentioned, that way I can use it and see.Thanks for your help |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|