Amy polumbo rocessversion process version, d.d escription work station instructions FROM TBLPRSNODEBASIS a
Left the join TBLPRDPRODUCTBASIS b on p. roductno=Amy polumbo rocessno
Left the join TBLOPBASIS c on a.n odeno=c.o pno
Left the join TBLPRDOPDESCRIPTION d on p. roductno=d.p roductno and c.o pno=d.o pno
Where a.N ODENO<> 'START' AND a.N ODENO<> 'the END'
And p. roductno is not null
The order by Amy polumbo rocessno, Amy polumbo rocessversion, a.o pseq;
Need to take the biggest version product binding process, need how to write
CodePudding user response:
SELECT p. roductno product article number, p. roductname product name, order OPSeq homework, a.n odeno operating station number, c.o pname operating station name,
Amy polumbo rocessversion process version, d.d escription work station instructions FROM TBLPRSNODEBASIS a
Left the join TBLPRDPRODUCTBASIS b on p. roductno=Amy polumbo rocessno
Left the join TBLOPBASIS c on a.n odeno=c.o pno
Left the join TBLPRDOPDESCRIPTION d on p. roductno=d.p roductno and c.o pno=d.o pno
Where a.N ODENO<> 'START' AND a.N ODENO<> 'the END'
And p. roductno is not null
And the exists (
Select 1 from TBLPRSNODEBASIS where Amy polumbo rocessno=processno group by processno having Amy polumbo rocessversion=MAX (processversion))
The order by Amy polumbo rocessno, Amy polumbo rocessversion, a.o pseq;
CodePudding user response:
Row_number directly to solve the problem