Hi,
Can you help me with this one?
I need to select Revision a parts
- from Approved (True) Revisions only
- the revision with the MAX Effective date
So from these part revisions
PartNum___Rev___Approved___EffectiveDate
1234567...C.....True.......1989-07-16
1234567...B.....True.......1990-07-16
1234567...A.....False......2008-11-30
I just want this one
PartNum___Rev___Approved___EffectiveDate
1234567...B.....True.......1990-07-16
I had previously used the SELECT statement below to get the Revision with the MAX date.
Now I need to consider the Approved state & have been stuck.
SELECT
pr01.partnum as "Part",
pr01.RevisionNum as "Rev",
pr01.Approved as "Aprv",
pr01.EffectiveDate as "Eff"
FROM PartRev pr01
LEFT PartRev pr02
ON (pr01.Company = pr02.Company and pr01.PartNum = pr02.PartNum and pr01.EffectiveDate < pr02.EffectiveDate)
WHERE pr01.PartNum = '1234567' and pr02.EffectiveDate IS NULL;
Haven't had any luck with adding any Approved criteria to the existing select statement.
I'm thinking I need scrap it and start over?
Thanks
Bruce O
Can you help me with this one?
I need to select Revision a parts
- from Approved (True) Revisions only
- the revision with the MAX Effective date
So from these part revisions
PartNum___Rev___Approved___EffectiveDate
1234567...C.....True.......1989-07-16
1234567...B.....True.......1990-07-16
1234567...A.....False......2008-11-30
I just want this one
PartNum___Rev___Approved___EffectiveDate
1234567...B.....True.......1990-07-16
I had previously used the SELECT statement below to get the Revision with the MAX date.
Now I need to consider the Approved state & have been stuck.
SELECT
pr01.partnum as "Part",
pr01.RevisionNum as "Rev",
pr01.Approved as "Aprv",
pr01.EffectiveDate as "Eff"
FROM PartRev pr01
LEFT PartRev pr02
ON (pr01.Company = pr02.Company and pr01.PartNum = pr02.PartNum and pr01.EffectiveDate < pr02.EffectiveDate)
WHERE pr01.PartNum = '1234567' and pr02.EffectiveDate IS NULL;
Haven't had any luck with adding any Approved criteria to the existing select statement.
I'm thinking I need scrap it and start over?
Thanks
Bruce O