M
Mickey1234
Hi,
How would I be able to use CASE statement if it applies to different
table. For example: I have 3 tables, billing, Job_2 and
JOB_COST_Query1_Sub
I want apply this CASE statement and extract some data from the third
table: cost. How would that be possibly be done ? Sounds complicated,
isn't it? Please help .....
Example:
-----------
SELECT dbo.billing.Job_No
FROM dbo.billing INNER JOIN
dbo.Job_2 ON dbo.billing.Job_No = dbo.Job_2.Job_No INNER JOIN
dbo.JOB_COST_Query1_Sub() JOB_COST_Query1_Sub ON dbo.Job_2.Job_No =
JOB_COST_Query1_Sub.Job_No
WHERE (dbo.billing.Job_No = @JobNumber)
Have tried and modified the following query, but it didn't work, why?
SELECT dbo.billing.Job_No, dbo.JOB_COST_Query_Sub, CASE WHEN
[CountAFE]>1 Then 'Multiple' Else [FirstOfAFE No],
FROM dbo.billing INNER JOIN
dbo.Job_2 ON dbo.billing.Job_No = dbo.Job_2.Job_No INNER JOIN
dbo.JOB_COST_Query1_Sub() JOB_COST_Query1_Sub ON dbo.Job_2.Job_No =
JOB_COST_Query1_Sub.Job_No
WHERE (dbo.billing.Job_No = @JobNumber)
Thanks.
How would I be able to use CASE statement if it applies to different
table. For example: I have 3 tables, billing, Job_2 and
JOB_COST_Query1_Sub
I want apply this CASE statement and extract some data from the third
table: cost. How would that be possibly be done ? Sounds complicated,
isn't it? Please help .....
Example:
-----------
SELECT dbo.billing.Job_No
FROM dbo.billing INNER JOIN
dbo.Job_2 ON dbo.billing.Job_No = dbo.Job_2.Job_No INNER JOIN
dbo.JOB_COST_Query1_Sub() JOB_COST_Query1_Sub ON dbo.Job_2.Job_No =
JOB_COST_Query1_Sub.Job_No
WHERE (dbo.billing.Job_No = @JobNumber)
Have tried and modified the following query, but it didn't work, why?
SELECT dbo.billing.Job_No, dbo.JOB_COST_Query_Sub, CASE WHEN
[CountAFE]>1 Then 'Multiple' Else [FirstOfAFE No],
FROM dbo.billing INNER JOIN
dbo.Job_2 ON dbo.billing.Job_No = dbo.Job_2.Job_No INNER JOIN
dbo.JOB_COST_Query1_Sub() JOB_COST_Query1_Sub ON dbo.Job_2.Job_No =
JOB_COST_Query1_Sub.Job_No
WHERE (dbo.billing.Job_No = @JobNumber)
Thanks.