2017-04-09 76 views
0
select * from 
(select child as enfant,title as libelle, COALESCE(parent ,child) as Parent 
from tree2) as tree2 
order by COALESCE(parent , 1),parent,enfant 

我在Postgres的寫了這個查詢和它的作品,但是當我在我的程序ASP C#中使用它,它不返回任何東西,就像他不要噸有任何數據 什麼問題的任何幫助thnks和索裏,我的英語SQL Postgres裏

+0

那麼它聽起來像C#代碼是什麼原因呢。當您從C#運行查詢時會發生什麼? –

+0

請包含您的C#代碼,以便我們可以查看是否有錯誤。 –

回答

0
select * from 
(select child as enfant,title as libelle, COALESCE(parent ,child) as Parent 
from tree2) as tree2 
order by COALESCE(parent , 1),parent,enfant 

是一樣的...

select child as enfant, title as libelle, COALESCE(parent ,child) as Parent 
from tree2 
order by parent NULLS LAST, enfant NULLS LAST 

但在C#這是另一個問題,我們不能只是想不通的問題有沒有任何信息都不知道。

0

薩拉姆 是奇怪,但我解決它只是,它在我的C#代碼 任何方式thnks

用於查詢 「選擇孩子作爲朗方,標題爲libelle問題,COALESCE(父母,子女)從tree2 順序由家長NULLS家長
LAST,朗方NULLS LAST」 贊成票是一樣的我嘗試它,它相當與URS明確thnks