Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add fields in single row

Status
Not open for further replies.

DeadIslets

Programmer
Apr 3, 2002
45
0
0
US
I'm attempting to create a view with one of the fields in the view being the addition of several fields in a single row. You can see in the code window what I've tried to do but it doesn't work. I realize this is probably a simple question but I very much appreciate your help. Thanks.

Keith

Code:
CREATE VIEW DelvStat (ZipCode, City, State, Route, Active) AS
 SELECT     dbo.DeliveryStatistics.ZipCode, dbo.ZipCode.City, dbo.ZipCode.State, 
                  dbo.DeliveryStatistics.CarrierRouteID, (dbo.DeliveryStatistics.ActvBusCentralCnt,
                  dbo.DeliveryStatistics.ActvBusCurbCnt + dbo.DeliveryStatistics.ActvBusNDCBUCnt) AS Active,
                  dbo.DeliveryStatistics.ActvBusCentralCnt, dbo.DeliveryStatistics.ActvBusCurbCnt, 
                  dbo.DeliveryStatistics.ActvBusNDCBUCnt
 FROM        dbo.DeliveryStatistics INNER JOIN
                   dbo.ZipCode ON dbo.DeliveryStatistics.ZipCode = dbo.ZipCode.ZipCode
 WHERE      (dbo.DeliveryStatistics.ZipCode = @ZipCode)
 
there's a comma where there should be a plus sign

look hard, you'll find it :)

tip: test your queries as queries before using them to create views

r937.com | rudy.ca
 
r937:

Thanks for the feedback on this. I found the problem, even before the good advice, but since I was struggling with unfamiliar syntax as well, I think my brain became garbled.

Thanks again.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top