I am using sqlite.

What I want is to list everything in _id order, but if there is a connecting item, it should come below the parent item. In short, a parent item has a 0 in connection, but a related item has the parent _id in the connection.

If this is not possible, then I need to do my own objects for this, but if this would be possible in one sql command, that would be perfect.


Trausti

On Apr 18, 2006, at 8:13 PM, Norman Palardy wrote:


On Apr 18, 2006, at 10:52 AM, Trausti Thor Johannsson wrote:

The table is like this :


_id int primary key
sometext varchar
....
connection int


the connection can be 0, or it can be connecting to the _id. I want to display all data regardless of connection, but if there is a connection it should trail it, like :

1 text1 0
2 text2 0
5 Sometextconn2 2
3 text3 0
4 text4 0


Anyone know how to do that ?

Any reason a query like

        select _id, sometext, connection from table

won't work for you ?

If connection can be NULL maybe

        select _id, sometext, coalesce(connection,'0') from table

assuming the database engine you're using supports "coalesce" or something like it

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to