[pgsql-jp: 25624] Re: JOINの使い方!?
松嶋祥文
mats @ itboost.co.jp
2002年 4月 19日 (金) 15:00:07 JST
松嶋@ITBoost です。
| まず、このようなテーブルとデータを作ります。
(snip)
| cast1 はともかくとして、cast2のcastnameを取得するには
| どうすればいいのでしょうか?
試していませんが、相関サブクエリをつかって
select m1.id, m1.name,
(select castname from castindex c2 where c2.castid=m1.cast1),
(select castname from castindex c3 where c3.castid=m1.cast2)
from mail m1
こんな感じでどうでしょう?
--
,-------------+
+---------------------------------------------' |
| システム開発&エンジニアスクール アイティーブースト |
| 取締役副社長 松嶋 祥文 [ mats @ itboost.co.jp ] ,-------------+
| +----------------------------------------------' |
| | ★ Linux 関連の技術情報満載! http://www.itboost.co.jp/ |
+-|■■■■■ Web アプリケーション開発、請け負います!■■■■■|
+-------------------------------------------------------------+
pgsql-jp メーリングリストの案内