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 |
eilob
Starting Member
6 Posts |
Posted - 2008-04-22 : 12:09:11
|
Hi all, I have a problem with a subquery, trying to get a Fusion chart working in Visual Studio, but when i run it I get an error in the SQL query: The column prefix 'd' does not match with a table name or alias name used in the query.The column prefix 'd' does not match with a table name or alias name used sql1 = "Select (d.WeekofYr)," + "(select PSC_Approved, Field_Approved, All_Requests from Bid_Desk_France_Cumulative_Margin_Approved where d.WeekOfYr='1 Jan 2008') AS Week1," + " (select PSC_Approved, Field_Approved, All_Requests from Bid_Desk_France_Cumulative_Margin_Approved where d.WeekOfYr='7 Jan 2008') AS Week2," + " (select PSC_Approved, Field_Approved, All_Requests from Bid_Desk_France_Cumulative_Margin_Approved where d.WeekOfYr='14 Jan 2008') AS Week3," + " (select PSC_Approved, Field_Approved, All_Requests from Bid_Desk_France_Cumulative_Margin_Approved where d.WeekOfYr='21 Jan 2008') AS Week4," + " (select PSC_Approved, Field_Approved, All_Requests from Bid_Desk_France_Cumulative_Margin_Approved where d.WeekOfYr='28 Jan 2008') AS Week5," + " (select PSC_Approved, Field_Approved, All_Requests from Bid_Desk_France_Cumulative_Margin_Approved where d.WeekOfYr='4 Feb 2008') AS Week6" + " from Bid_Desk_France_Cumulative_Margin_Approved";Thks & regards |
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2008-04-22 : 12:51:32
|
Try deleting the "d." bits of your query.Whether that works or not, you should post your table structure, a few rows of sample data and the output you would want for that sample data. Your query can be improved hugely...Ryan Randall Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
eilob
Starting Member
6 Posts |
Posted - 2008-04-25 : 05:07:50
|
Hi This is my table structure: WeekofYr PSC_Approved Field_Approved All_Requests07/04/2008 50 60 4514/04/2008 48 36 5021/04/2008 29 45 2828/04/2008 36 41 42Thks & Rgds |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|
|