sales invoice line to sales order line, SQL query. Review please.

Hello ladies and gents,

My first post so I’ll make it a pro-active one (Done a LOT to make sure I’m not asking the same questions again)

I’ve reviewed the code behind the sales invoice line table that performs the get shipment lines function, and think I’ve been able to create a SQL query that gets purchase order line no from the sales invoice line no_, it seems to work but was hoping someone could cast their eye over it and see if I’ve missed anything.

select ssl.[order no_], ssl.[order line no_], ile.[document no_],ile.[document line no_], VE.[entry no_],VE.[document no_],VE.[document line no_], VE.[document type],ile.[document type] from
[company ltd$value entry] as VE

inner join [company ltd$item ledger entry] as ILE

INNER JOIN [company LTD$SALES SHIPMENT LINE] AS SSL

ON ILE.[document no_]=ssl.[document no_] and ile.[document line no_]=ssl.[line no_]

on ile.[entry no_]=ve.[item ledger entry no_]

where ve.[document type]=2 and ile.[document type]=1

Any input or thoughts on this would be appreciated.

Jeff