TariqMehmod
Programmer
Sir I have this query in sqlserver query editor
The codes work fine as shown in image
Now I use same codes in Crystal report command like this
When I press OK then it show error message like this
Please help me to make my query workable in crystal report command box
I want to use this query in Crystal report
Please help
Code:
SELECT man1, gate, vehicle,weight/(IIF(LEN(man1)=0, 0, 1)+IIF(LEN(man2)=0, 0, 1)
+IIF(LEN(man3)=0, 0, 1)+IIF(LEN(man4)=0, 0, 1))as wages
FROM Table_1
WHERE LEN(man1)>0
UNION ALL
SELECT man2, gate, vehicle,weight/(IIF(LEN(man1)=0, 0, 1)+IIF(LEN(man2)=0, 0, 1)
+IIF(LEN(man3)=0, 0, 1)+IIF(LEN(man4)=0, 0, 1))as wages
FROM table_1
WHERE LEN(man2) >0
UNION ALL
SELECT man3, gate, vehicle,weight/(IIF(LEN(man1)=0, 0, 1)+IIF(LEN(man2)=0, 0, 1)
+IIF(LEN(man3)=0, 0, 1)+IIF(LEN(man4)=0, 0, 1))as wages
FROM table_1
WHERE LEN(man3) >0
UNION ALL
SELECT man4, gate, vehicle,weight/(IIF(LEN(man1)=0, 0, 1)+IIF(LEN(man2)=0, 0, 1)
+IIF(LEN(man3)=0, 0, 1)+IIF(LEN(man4)=0, 0, 1))as wages
FROM table_1
WHERE LEN(man4) >0
ORDER BY 1 asc
The codes work fine as shown in image
Now I use same codes in Crystal report command like this
When I press OK then it show error message like this
Please help me to make my query workable in crystal report command box
I want to use this query in Crystal report
Code:
SELECT odln.u_loader1, odln.DocNum, odln.u_truck,odln.U_WE2/(IIF(len(odln.u_loader1)=0, 0, 1)+IIF(len(odln.u_loader2)=0, 0, 1)+IIF(len(odln.u_loader3)=0, 0, 1)+IIF(len(odln.u_loader4)=0, 0, 1))
FROM odln
WHERE len(odln.u_loader1)>0
UNION ALL
SELECT odln.u_loader2, odln.DocNum, odln.u_truck,odln.U_WE2/(IIF(len(odln.u_loader1)=0, 0, 1)+IIF(len(odln.u_loader2)=0, 0, 1)+IIF(len(odln.u_loader3)=0, 0, 1)+IIF(len(odln.u_loader4)=0, 0, 1))
FROM odln
WHERE len(odln.u_loader2) >0
UNION ALL
SELECT odln.u_loader3, odln.DocNum, odln.u_truck,odln.U_WE2/(IIF(len(odln.u_loader1)=0, 0, 1)+IIF(len(odln.u_loader2)=0, 0, 1)+IIF(len(odln.u_loader3)=0, 0, 1)+IIF(len(odln.u_loader4)=0, 0, 1))
FROM odln
WHERE len(odln.u_loader3) >0
UNION ALL
SELECT odln.u_loader4, odln.DocNum, odln.u_truck,odln.U_WE2/(IIF(len(odln.u_loader1)=0, 0, 1)+IIF(len(odln.u_loader2)=0, 0, 1)+IIF(len(odln.u_loader3)=0, 0, 1)+IIF(len(odln.u_loader4)=0, 0, 1))
FROM odln
WHERE len(odln.u_loader4) >0
ORDER BY 1 asc
Please help