beanbeanbean
Registered User.
- Local time
- Today, 13:25
- Joined
- Sep 17, 2008
- Messages
- 124
hi guys, i kind of have a problem.
currently i have a query which goes like this:
SELECT test1.[Opty Id], test1.[Opty Name], SJ_CIS.NEWCINSFX, test1.[Contact CIN], test1.[Contact CIN SFX], test1.[Create By (Name)], test1.[Created By (Login)], test1.[Opty Created Date], SJ_CIS.JOIN_DATE, test1.[Opty Closed Date], test1.[Closed By (Emp #)], test1.[Referral - Employee #], test1.[Referral - Employee], test1.[Sales Rep], test1.Product
FROM test1 INNER JOIN SJ_CIS ON [test1].[Contact CIN] & [test1].[Contact CIN SFX]=[SJ_CIS].[NEWCINSFX]
WHERE (((test1.[Sales Rep Position]) Like '*INTL*')
AND (CDate([test1].[Opty Created Date]) < [SJ_CIS].[JOIN_DATE])
AND ([SJ_CIS].[JOIN_DATE] < CDate([test1].[Opty Closed Date])));
what this query does is that it combines 2 tables together thus enabling me to compare the creation date, join date and the close date using a common field which is the NEWSINSFX.
now what i want the query to pull out is all the CIN numbers which have the requirements
Creation Date < Join Date < Close Date.
This code was working well. But i've encountered a problem ! And would like to request help.
its seems like the data base has got duplicates ! this means the data in the table can look like this
NEWCINSFX | CREATION | JOIN | CLOSED
D2934338E | 2/10/2008 | 5/11/2008 | 3/12/2008 (correct)
D2934338E | 22/10/2008 | 24/10/2008 | 22/10/2008 (wrong)
as you can see there is the exact same NEWCINSFX but the entry for the dates are different.
since my criteria for the query is Creation < Join < Close it should pull this NEWCINSFX out as it meets the requirements but because of the wrong dates of the duplicate it could not pull the NEWCINSFX out. how do i bypass this problem ?
also there is another problem,
NEWCINSFX | CREATION | JOIN | CLOSED
D2934338E | 2/10/2008 | 5/11/2008 | 3/12/2008 (correct)
D2934338E | 15/10/2008 | 20/11/2008 | 1/12/2008 (correct)
i also have some duplicates which have correct dates in both of them. i would like to pull the earlier date. this means i want to pull the one with 2/10/2008 creation date out. how do i do that ?
thanks in advanced. god bless
currently i have a query which goes like this:
SELECT test1.[Opty Id], test1.[Opty Name], SJ_CIS.NEWCINSFX, test1.[Contact CIN], test1.[Contact CIN SFX], test1.[Create By (Name)], test1.[Created By (Login)], test1.[Opty Created Date], SJ_CIS.JOIN_DATE, test1.[Opty Closed Date], test1.[Closed By (Emp #)], test1.[Referral - Employee #], test1.[Referral - Employee], test1.[Sales Rep], test1.Product
FROM test1 INNER JOIN SJ_CIS ON [test1].[Contact CIN] & [test1].[Contact CIN SFX]=[SJ_CIS].[NEWCINSFX]
WHERE (((test1.[Sales Rep Position]) Like '*INTL*')
AND (CDate([test1].[Opty Created Date]) < [SJ_CIS].[JOIN_DATE])
AND ([SJ_CIS].[JOIN_DATE] < CDate([test1].[Opty Closed Date])));
what this query does is that it combines 2 tables together thus enabling me to compare the creation date, join date and the close date using a common field which is the NEWSINSFX.
now what i want the query to pull out is all the CIN numbers which have the requirements
Creation Date < Join Date < Close Date.
This code was working well. But i've encountered a problem ! And would like to request help.
its seems like the data base has got duplicates ! this means the data in the table can look like this
NEWCINSFX | CREATION | JOIN | CLOSED
D2934338E | 2/10/2008 | 5/11/2008 | 3/12/2008 (correct)
D2934338E | 22/10/2008 | 24/10/2008 | 22/10/2008 (wrong)
as you can see there is the exact same NEWCINSFX but the entry for the dates are different.
since my criteria for the query is Creation < Join < Close it should pull this NEWCINSFX out as it meets the requirements but because of the wrong dates of the duplicate it could not pull the NEWCINSFX out. how do i bypass this problem ?
also there is another problem,
NEWCINSFX | CREATION | JOIN | CLOSED
D2934338E | 2/10/2008 | 5/11/2008 | 3/12/2008 (correct)
D2934338E | 15/10/2008 | 20/11/2008 | 1/12/2008 (correct)
i also have some duplicates which have correct dates in both of them. i would like to pull the earlier date. this means i want to pull the one with 2/10/2008 creation date out. how do i do that ?
thanks in advanced. god bless
Last edited: