9tanstaafl9
Well-known Member
- Joined
- Mar 23, 2008
- Messages
- 535
Hi,
I know nothing of queries so bear with me. The following query is working for me, EXCEPT that it is returning occasional duplicate values. I only want each number to appear once. I thought using the Union and the Select Distinct would solve the problem but it didn't. Any ideas?
This has been driving me crazy all day, trying to figure out how to eliminate the duplicates so I can copy the list somewhere else for my macto. It finally occured to me that maybe I could avoid that, and some brilliant person could just tell me what's wrong with the query instead???
Jennifer
I know nothing of queries so bear with me. The following query is working for me, EXCEPT that it is returning occasional duplicate values. I only want each number to appear once. I thought using the Union and the Select Distinct would solve the problem but it didn't. Any ideas?
Code:
SELECT DISTINCT actrec.recnum
FROM actrec actrec, jobcst jobcst
WHERE ((actrec.recnum=jobcst.jobnum) AND ((jobcst.status=$1) AND ((jobcst.actprd>=?) AND (jobcst.actprd<=?))))
UNION
SELECT DISTINCT actrec.recnum
FROM actrec actrec, acrinv acrinv
WHERE ((actrec.recnum=acrinv.jobnum) AND ((acrinv.status<=$4) AND ((acrinv.actper>=?) AND (acrinv.actper<=?))))
UNION
SELECT DISTINCT actrec.recnum
FROM actrec actrec
WHERE (actrec.status=$3)
This has been driving me crazy all day, trying to figure out how to eliminate the duplicates so I can copy the list somewhere else for my macto. It finally occured to me that maybe I could avoid that, and some brilliant person could just tell me what's wrong with the query instead???
Jennifer