[firebird-support] SQL puzzle: Order based on Prerequisite

2015-04-08 Thread firebirdbest...@yahoo.com [firebird-support]
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

Re: [firebird-support] SQL puzzle: Order based on Prerequisite

2015-04-11 Thread liviusliv...@poczta.onet.pl [firebird-support]
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

Re: [firebird-support] SQL puzzle: Order based on Prerequisite

2015-04-11 Thread liviusliv...@poczta.onet.pl [firebird-support]
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

Re: [firebird-support] SQL puzzle: Order based on Prerequisite

2015-04-12 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
>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