Tables: First id parent_id - null foreign_id - not null Foreign: id name


When i do select like Query.All<first> it will make SQL like

select * from first p inner join foreign f on (f.id = p.foreign_id) left join first pp on (p.parent_id = pp.id) inner join foreign ff (ff.id = pp.foreign_id)<<--- This is a mistake, this query will hide entries with parent_id = null. It should be left joined or better grouped with parethesis like:

select * from first p inner join foreign f on (f.id = p.foreign_id) left join (select * first pp on (p.parent_id = pp.id) inner join foreign ff on (ff.id = pp.foreign_id)) as bla


Updated at 26.07.2010 6:26:59

here is the test

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 22 '10 at 12:40

xumix's gravatar image

xumix
425707682

edited Aug 12 '10 at 09:40

Can you provide a bit more details about the types \ hierarchies? It's unclear why Query.All<first>() executes such SQL.

(Jul 22 '10 at 12:40) Alex Yakunin Alex%20Yakunin's gravatar image

We're working on this issue.

(Jul 22 '10 at 12:40) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

I suppose this is fixed now?

answered Aug 20 '10 at 06:16

xumix's gravatar image

xumix
425707682

1

Yes, it works now

(Aug 24 '10 at 11:20) Alexis Kochetov Alexis%20Kochetov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA