[pgsql-jp: 25512] Re: サブクエリーでのdistinct の利用について
SUGIMURA Takashi 杉村 貴士
sugimura @ infoscience.co.jp
2002年 4月 2日 (火) 16:10:11 JST
杉村です。
# これは「レス」ではありません
> 早速のレスありがとうございます。
> select distinct on (C) * from TABLE where A = '***' order by B;
> は、一度トライしてみたんですが、
> 「SELECT DISTINCT ON expressions must match initial ORDER BY expressions」
> と
> なって、実行を返してくれませんでした。
> disitnctのCとorder byのBが合わなければならないとこのことなのでしょうか?
>
> またサブクエリーについては、select文の中でselect文を作れるという安易な考え
> だけで
> TRYしていました。お恥ずかしい限りです。_(._.)_
>
こうするのでは?
select distinct p.c from
(select distinct on (c) b, c from table where a = '***') as p
order by p.b;
---
インフォサイエンス株式会社 プロダクト開発チーム
杉村 貴士 <sugimura @ infoscience.co.jp>
TEL: 03-5427-3509(直通), 03-5427-3500(代表) FAX: 03-5427-3530
pgsql-jp メーリングリストの案内