Here is the detail explaination:
SELECT dbo.Jobs.JobID, dbo.Jobs.JobStation, dbo.Jobs.JobStatus, dbo.Jobs.InvoiceDate, dbo.Jobs.JobDate, dbo.Jobs.JobUnit, dbo.Jobs.Customer,
dbo.Jobs.Field, dbo.Jobs.WellName, dbo.Jobs.WellID, dbo.Jobs.WellQuarter, dbo.Jobs.WellSubsection, dbo.Jobs.WellTownship, dbo.Jobs.WellRange,
dbo.Jobs.WellMeridian, dbo.Jobs.JobNumber, dbo.JobPersonnel.EmployeeCategory, dbo.JobPersonnel.EmployeeID, dbo.Items.ItemNumber,
dbo.Items.ItemProduct, dbo.Items.ItemService, dbo.Items.BonusCategory, dbo.JobPrices.DiscountedPrice, dbo.JobPersonnel.ElectriclineBonus,
dbo.JobPersonnel.SlicklineBonus, dbo.JobPersonnel.ConsumableBonus, dbo.JobPersonnel.BonusOverride, dbo.JobPersonnel.DriveHours,
dbo.JobPersonnel.SpecialBonus, dbo.Employees.EmployeeGuarantee, dbo.Employees.EmployeeVacationPercent,
dbo.Employees.EmployeeFirstName, dbo.Employees.EmployeeLastName, dbo.Employees.EmployeeLocation, dbo.Jobs.JobProvince,
CASE WHEN ([JobPersonnel].[DriveHours] > 4) THEN ((DriveHours - 4) * 10) ELSE 0 END AS DriveBonus,
CASE WHEN ([Items].[BonusCategory] = 'Service') THEN DiscountedPrice ELSE 0 END AS Service,
CASE WHEN ([Items].[BonusCategory] = 'Mechanical') THEN DiscountedPrice ELSE 0 END AS Mechanical,
CASE WHEN ([Items].[BonusCategory] = 'Expendable') THEN DiscountedPrice ELSE 0 END AS Expendable, dbo.JobPrices.ItemNumber AS Expr5,
dbo.JobPrices.Quantity
FROM dbo.Jobs INNER JOIN
dbo.JobPersonnel ON dbo.Jobs.JobNumber = dbo.JobPersonnel.JobNumber INNER JOIN
dbo.Employees ON dbo.JobPersonnel.EmployeeID = dbo.Employees.EmployeeID INNER JOIN
dbo.JobPrices ON dbo.Jobs.JobNumber = dbo.JobPrices.JobNumber INNER JOIN
dbo.Items ON dbo.JobPrices.ItemNumber = dbo.Items.ItemNumber
WHERE (dbo.Jobs.InvoiceDate >= @Invoice_Date_From__MM_DD_YY__) AND (dbo.Jobs.InvoiceDate <= @Invoice_Date_To__MM_DD_YY__) AND
(dbo.Jobs.JobStatus = 7)
above is the query I crated using table Jobs, where, case statement are there and those column are expression base, not present in table. I want to use those column in my report say =sum ([service]*2 + [mechanical]02.5])
but when i run the querry its give the error message. I wanted to put another expression in querry using "sum ([service]*2 + [mechanical]02.5])" it also give me the error message. I have a lot of function like this in my front end and really worried now where i can make this working or not, or is there any way i can solve this problem, so that my migration from access to sql can be used soon.
Thanks for help.
Indra.