SQLite query to get data from multiple tables -



SQLite query to get data from multiple tables -

i have 4 tables,

modtable file_id, mod_flag

tracktable artist_id album_id file_id title

albumtable album_id, album

artisttable artist_id, artist

i need artist_id, album_id, album, artist, fid, title these tables file_id mod_flag=1

so far did (pseudo code)

1. select file_id, artist_id, album_id, title tracktable file_id in (select file_id modtable mod_flag=1);

in extreme cases, homecoming 30000 file_ids. these file_ids,

2. for(int count=0; count < noofrecords/*30000*/; count++) select artist artisttable artist_id==%llu select album albumtable album_id==%llu

the above query works me wanted know whether optimized way implement this. should avoid queries within loop?

normaly bring together tables below. should result in improve performance, because joins can optimized query engine.

select t.file_id, t.artist_id, t.album_id, t.title, a.album, ar.artist tracktable t bring together albumtable on t.album_id = a.album_id bring together artisttable ar on t.artist_id = ar.artist_id t.file_id in (select file_id modtable mod_flag=1);

sqlite

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -