Subject Re: Self-Joined Items Master and transactions stock ledger
Author Bhavbhuti Nathwani
Hi Svein

There is no need to say sorry, I appreciate your help to me immensely and I can understand you have other commitments too, but I am totally obsessed with getting this thing perfect :).

Yessss!!! Thanks for the latest update to the query (see the commented line about something I learnt, sorry I am a slow learner)

WITH RECURSIVE Hier(iID, iPK) AS
(SELECT p.iID, p.iID AS iPK FROM mItems p WHERE p.iID IN
(SELECT ID
FROM gttItemsSelected
WHERE TRIM(JobID) = '_2M60RJ9T4')
UNION ALL
SELECT H.iID, p2.iID AS iPK FROM mItems p2
JOIN Hier H on p2.iPID = H.iPK)

--SELECT * from Hier
SELECT Hier.iID AS iItemID, Hier.iPK AS iItemPK, sGRNItem.iID
FROM sGoodsRecvNoteItem sGRNItem
JOIN Hier
ON sGRNItem.iItemID = Hier.iPK

I will now go ahead with the actual coding and will keep you posted.

Thanks and regards.
Bhavbhuti


--- In firebird-support@yahoogroups.com, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
>Then I tried to see what was different, and I think you may have to delete one letter: