I am doing something like this in my select statment
Query -1
SELECT Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, SUM(emplhrdtltest.totaltime) AS Expr1, emplhrdtltest.[date]
FROM Indirectlabcode INNER JOIN
emplhrdtltest ON Indirectlabcode.Labcode = emplhrdtltest.labcode
GROUP BY Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, emplhrdtltest.[date]
HAVING (emplhrdtltest.[date] = '02192004')
result i get is
******************************************************
Result -1
16 1 000000 32.5 02192004
60 1 000000 16 02192004
68 1 000000 33 02192004
69 1 000000 16 02192004
If i do
Query -2
----------------------------------------------------------
SELECT Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, SUM(emplhrdtltest.totaltime) AS Expr1, emplhrdtltest.[date],
emplhrdtltest.totaltime * 15 AS Expr2
FROM Indirectlabcode INNER JOIN
emplhrdtltest ON Indirectlabcode.Labcode = emplhrdtltest.labcode
GROUP BY Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, emplhrdtltest.[date], emplhrdtltest.totaltime * 15
HAVING (emplhrdtltest.[date] = '02192004')
-----------------------------------------------------
i get
Result -2
16 1 000000 24 02192004 120
16 1 000000 8.5 02192004 127.5
60 1 000000 16 02192004 120
68 1 000000 33 02192004 123.75
69 1 000000 16 02192004 120
I want result -1 when i run query-2 for some reason i get 16 labcode twice not sure why . I checked my tables if i need to some result should have as result -1
Thanks
Query -1
SELECT Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, SUM(emplhrdtltest.totaltime) AS Expr1, emplhrdtltest.[date]
FROM Indirectlabcode INNER JOIN
emplhrdtltest ON Indirectlabcode.Labcode = emplhrdtltest.labcode
GROUP BY Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, emplhrdtltest.[date]
HAVING (emplhrdtltest.[date] = '02192004')
result i get is
******************************************************
Result -1
16 1 000000 32.5 02192004
60 1 000000 16 02192004
68 1 000000 33 02192004
69 1 000000 16 02192004
If i do
Query -2
----------------------------------------------------------
SELECT Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, SUM(emplhrdtltest.totaltime) AS Expr1, emplhrdtltest.[date],
emplhrdtltest.totaltime * 15 AS Expr2
FROM Indirectlabcode INNER JOIN
emplhrdtltest ON Indirectlabcode.Labcode = emplhrdtltest.labcode
GROUP BY Indirectlabcode.Labcode, emplhrdtltest.shiftnumber, emplhrdtltest.jobnumber, emplhrdtltest.[date], emplhrdtltest.totaltime * 15
HAVING (emplhrdtltest.[date] = '02192004')
-----------------------------------------------------
i get
Result -2
16 1 000000 24 02192004 120
16 1 000000 8.5 02192004 127.5
60 1 000000 16 02192004 120
68 1 000000 33 02192004 123.75
69 1 000000 16 02192004 120
I want result -1 when i run query-2 for some reason i get 16 labcode twice not sure why . I checked my tables if i need to some result should have as result -1
Thanks