Kristoffer Danielsson <kristoffer.daniels...@live.se> wrote:
>> From: oliver....@web.de
>> a little mistake - here's the correction:
>> 
>> SELECT DISTINCT t.Year, b.Name,
>> (SELECT SomeValue FROM Test INNER JOIN Test2 WHERE Year = t.Year AND Name =
>> b.Name) AS SomeValue
>> FROM Test t
>> CROSS JOIN (SELECT DISTINCT Name FROM Test) b
>> ;
>
> Ah, this one's easier to follow.

See how you like this one:

select *
    from (select distinct year from Test) as AllYears
    join (select distinct name from Test) as AllNames
    left join Test t on (t.year=AllYears.Year and t.name=AllNames.name)
    left join Test2 t2 on (t.TestId = t2.TestId);

-- 
Igor Tandetnik
    

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to