Hi,

Here's a head's up on an obscure error I ran into. Maybe documenting
it will help the developers or a future victim:

I have a couple tables like this:

sqlite> .schema tracks
CREATE TABLE tracks (
        uuid text primary key not null,
        name text not null,
        type text not null,
        table_name text not null);

sqlite> .schema attributes
CREATE TABLE attributes (
        uuid NOT NULL,
        key text NOT NULL,
        value);

Tracks represent graphical objects and one of their (optional)
attributes is z-order. So, I wanted a query that would give me back
the tracks ordered by z-order. What I wanted was this, which actually
works fine:

select t.name, ifnull(a.value,-1) as zorder from tracks as t left join
(select * from attributes where key='z-order') as a on t.uuid=a.uuid
order by zorder;

A little muddled thinking on my part led to this totally bass-ackwards
attempted query:

sqlite> select * from tracks left join (select * from attributes where
tracks.uuid=attributes.uuid and key='z-order');
Bus error

I know my query is bogus, but Bus error is probably not the desired
feedback. Although, I can't say it's not deserved.

$ /opt/local/bin/sqlite3 -version
3.6.3

running on OS X 10.5.6

Sqlite rocks. Thanks,

-chris
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to