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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Query returns some 0 data

Status
Not open for further replies.

soahc00

Technical User
Oct 25, 2004
14
US
Hey guys,

I have a form that has an employee name, and they can enter up to six tasks that they did during the day...the query is as follows....


SELECT [tracking].[LastName] AS Name, [tracking].[date] AS Day, [tracking].[hrs1] AS Hours, [tracking].[task1seg] AS Segment
FROM tracking
WHERE ((GetLastUserNameEmployeeAct()=tracking.LastName))

UNION ALL SELECT [tracking].[LastName] AS Name, [tracking].[date] AS Day, [tracking].[hrs2] AS Hours, [tracking].[task2seg] AS Segment
FROM tracking
WHERE ((GetLastUserNameEmployeeAct()=tracking.LastName))

UNION ALL SELECT [tracking].[LastName] AS Name, [tracking].[date] AS Day, [tracking].[hrs3] AS Hours, [tracking].[task3seg] AS Segment
FROM tracking
WHERE ((GetLastUserNameEmployeeAct()=tracking.LastName))

UNION ALL SELECT [tracking].[LastName] AS Name, [tracking].[date] AS Day, [tracking].[hrs4] AS Hours, [tracking].[task4seg] AS Segment
FROM tracking
WHERE ((GetLastUserNameEmployeeAct()=tracking.LastName))

UNION ALL SELECT [tracking].[LastName] AS Name, [tracking].[date] AS Day, [tracking].[hrs5] AS Hours, [tracking].[task5seg] AS Segment
FROM tracking
WHERE ((GetLastUserNameEmployeeAct()=tracking.LastName))

UNION ALL SELECT [tracking].[LastName] AS Name, [tracking].[date] AS Day, [tracking].[hrs6] AS Hours, [tracking].[task6seg] AS Segment
FROM tracking
WHERE ((GetLastUserNameEmployeeAct()=tracking.LastName))
ORDER BY Day;



It also returns some 0 data like as in the hours, and tasks...this is because 0 is the default. I was wondering if anyone knows a way to ignore the 0 data....

Also, do comments exist in SQL?


Thanks!
 
WHERE ((GetLastUserNameEmployeeAct()=tracking.LastName) AND tracking.hrsX <>0 )

X is 1, 2 etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top