In a table called "Steps", I have the following fields:
ID, B4Me, Dsc,
-ID field contains a unique ID for each record
-B4Me contains the ID of some other record in the table that MUST appear in a
result set, BEFORE this record. B4Me may be null. This is called the "B4Me"
order.
-Reco
Subject: [firebird-support] SQL puzzle: Order based on Prerequisite
In a table called "Steps", I have the following fields:
ID, B4Me, Dsc,
-ID field contains a unique ID for each record
-B4Me contains the ID of some other record in the table that MUST appear in a
result s
S NULL THEN
ID ELSE B4ME+1 END, other_fields
FROM
STEPS
ORDER BY 1 ASC, 2 ASC
regards,
Karol Bieniaszewski
From: mailto:firebird-support@yahoogroups.com
Sent: Saturday, April 11, 2015 10:03 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] SQL puzzle: Order based on Prere
>In a table called "Steps", I have the following fields:
>
>ID, B4Me, Dsc,
>
>-ID field contains a unique ID for each record
>-B4Me contains the ID of some other record in the table that MUST appear in a
>result set, BEFORE this record. B4Me may be null. This is called the "B4Me"
>order.
>-Record