join - horizontal UNION ALL -


i have 2 tables , need select 1 column each of them. must done in single query. news 2 columns ordered right way , both contain same number of rows. now, know join 2 tables rowid, slow has comparison. in case not necessary... need more horizontal union concatenate 2 columns of equal length.

is possible in sqlite 3?

thanks.

table1:

| timestamp | field1 | field2 | ... | 12345678  | 000000 | 000000 | ... | 00154789  | 000000 | 000000 | ... 

table2:

| temperature | | 1000000000  | | 2000000000  | 

required select output

| timestamp | temperature | | 12345678  | 1000000000  | | 00154789  | 2000000000  | 

query:

select timestamp, temperature table1 inner join table2 on table1.rowid = table2.rowid; 

this takes ~0.75s in testing app. when 2 separate selects , join outputs later in program takes ~0.4s, not convenient. fastest way (~0.23s) have both columns in 1 table, wasteful have multiple versions of table2 share same timestamps.

sqlite supports union all.

two or more simple select statements may connected form compound select using union, union all, intersect or except operator. in compound select, constituent selects must return same number of result columns. components of compound select must simple select statements, may not contain order or limit clauses. order , limit clauses may occur @ end of entire compound select.

a compound select created using union operator returns rows select left of union operator, , rows select right of it. union operator works same way union all, except duplicate rows removed final result set. intersect operator returns intersection of results of left , right selects. except operator returns subset of rows returned left select not returned right-hand select. duplicate rows removed results of intersect , except operators before result set returned.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -