SQL Statement

CoachPhil

Registered User.
Local time
Today, 10:44
Joined
Jun 24, 2008
Messages
83
Has anyone come across a 'destination field' error in a query?

CoachPhil
 
I had updated the database to include a new column 'AgentName' and ran the query;

SELECT CLAvgQuery.[Certified Listeners Name] AS Expr1, CLAvgQuery.[AvgOfDid the CL give Feedback in a Timely Manner1] AS Expr2, FeedbackSessionTotalsQuery.[Avg Of Did the CL give Feedback in a Timely Manner] AS Expr3, FeedbackSessionTable1.[Did the CL give Feedback in a Timely Manner] AS Expr4, FeedbackSessionTable1.[Did the CL make you feel comfortable during the observation?] AS Expr5, FeedbackSessionTable1.[Did the CL accurately describe the performance adjustments?] AS Expr7, FeedbackSessionTable1.[Did the CL provide feedback in a professional manner?] AS Expr8, FeedbackSessionTable1.[Did the CL provide assistance in redirecting the issue or action] AS Expr9, FeedbackSessionTable1.AgentName AS Expr10, FeedbackSessionTable1.Date AS Expr11
FROM CLAvgQuery, FeedbackSessionTotalsQuery, FeedbackSessionTable1
GROUP BY CLAvgQuery.[Certified Listeners Name], CLAvgQuery.[AvgOfDid the CL give Feedback in a Timely Manner1], FeedbackSessionTotalsQuery.[Avg Of Did the CL give Feedback in a Timely Manner], FeedbackSessionTable1.[Did the CL give Feedback in a Timely Manner], FeedbackSessionTable1.[Did the CL make you feel comfortable during the observation?], FeedbackSessionTable1.[Did the CL accurately describe the performance adjustments?], FeedbackSessionTable1.[Did the CL provide feedback in a professional manner?], FeedbackSessionTable1.[Did the CL provide assistance in redirecting the issue or action], FeedbackSessionTable1.AgentName, FeedbackSessionTable1.Date, FeedbackSessionTable1.[Did the CL make you feel comfortable during the feedback session];

which led to:
Query must have at least one destination field


CoachPhil
 
You "grouped by" everything. How come?

There are tons of problems here but I'm just gonna mention the ones that might be causing this error.

1. Check your group by clause. It doesn't make sense.
2. You didn't join your tables. This will cause a cartesian product which may cause all kinds of problems.
3. Some of your field names have special characters (i.e. "?"). Remove them. "?" means something in SQL.
4. There are tons of things here that give evidence of non-normalized data. Makes it very hard to do 2 above.
5. Some DBMSs have problems with very long object names...you might want to make the names...brief. And remove spaces/special characters (in fact, only use letters to make it readable).

If following the above doesn't remedy the problem, post your db and somebody will take a look.
 

Users who are viewing this thread

Back
Top Bottom