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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Invalid Column Name

Author  Topic 

steve_ignorant
Starting Member

6 Posts

Posted - 2006-03-26 : 09:43:51
I am building a query and thought I had completed it but I get 'Invalid Column Name "A1" when I run it?
SELECT
Groups.GroupID,
Sum(Stages_On_Route.Distance) AS Miles_Covered,
Groups.Group_Name
FROM Groups
INNER JOIN ((Route INNER JOIN Departure ON (Route.GroupID=Departure.GroupID)
AND (Route.RouteID=Departure.RouteID))
INNER JOIN Stages_On_Route ON Route.RouteID=Stages_On_Route.RouteID)
ON Groups.GroupID=Departure.GroupID
GROUP BY Groups.GroupID,
Groups.Group_Name
HAVING (((Groups.GroupID)="A1"));

nr
SQLTeam MVY

12543 Posts

Posted - 2006-03-26 : 09:48:05
HAVING Groups.GroupID='A1'

actually should be
Where Groups.GroupID='A1'
and put before the group by clause.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-26 : 09:53:40
use single quote for string not double quote



KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant

Go to Top of Page

steve_ignorant
Starting Member

6 Posts

Posted - 2006-03-26 : 09:55:52
quote:
Originally posted by nr

HAVING Groups.GroupID='A1'

actually should be
Where Groups.GroupID='A1'
and put before the group by clause.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.



I am still getting the same error here after changing the code.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-26 : 09:56:54
Did you use single quote ?



KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant

Go to Top of Page

steve_ignorant
Starting Member

6 Posts

Posted - 2006-03-26 : 10:15:16
quote:
Originally posted by khtan

Did you use single quote ?



KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant





Ahh it's working, thanks.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-27 : 00:50:17
>>Ahh it's working,

It seems you didnt read the replies fully

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -