Re: [sqlite] UNION with results distinct on a particular column?

2009-03-24 Thread David Westbrook
Two possible solutions: A) pure sql ... (warning: untested) Start with all the possible col1 values, and then left join to the other tables, and pick the first col2 found. select col1, coalesce( A.col2, B.col2, C.col2 ) as col2 from ( select distinct col1 from ( select col1 from A un

[sqlite] UNION with results distinct on a particular column?

2009-03-24 Thread Matthew L. Creech
Hi, I'm hoping someone here can help me out with a query. I have multiple tables, each with the same schema. For example: = Table A: = 1|"xxx" 2|"yyy" 3|"zzz" = = Table B: = 1|"xxx222" 3|"zzz222" 5|"www" = I'd like a SELECT statement that yields