FireFly Media Server › Firefly Media Server Forums › Firefly Media Server › General Discussion › Limit smart playlists ? › Reply To: Limit smart playlists ?
31/12/2006 at 2:04 PM
#7921
fizze
Participant
well 😉
sqlite> insert into playlists (title,type,items,db_timestamp,idx) values ('Recent Adds',0,100,0,0);
sqlite> select last_insert_rowid();
154
sqlite> insert into playlistitems select NULL,154,id from songs order by time_added desc limit 100;
wow, that DB code looks weird.
is idx an auto-increment field? it should be a unique key anyhow. in oracle you do that with a sequence. anywho….
the statement
insert into playlistitems select NULL,154,id from songs order by time_added desc limit 100;
[/code]
looks weirdish too.
INSERT INTO playlistitems
(SELECT NULL, 154, id
FROM songs
ORDER BY time_added DESC limit 100);
that doesnt even look like proper SQL to me. you probably meant:
(SELECT id from SONGS ORDER by time_added DESC limit 100);
in that sub-select.
that deffo does a full table scan, since there are no indices.
I guess the last 100 indices of songs would suffice, since its a auto-increment field, or sequence of some-sort, right?
[/code]