Re: Basic SQL join question
От | codeWarrior |
---|---|
Тема | Re: Basic SQL join question |
Дата | |
Msg-id | b1d0bn$1e63$1@news.hub.org обсуждение исходный текст |
Ответ на | Basic SQL join question (Jean-Christian Imbeault <jc@mega-bucks.co.jp>) |
Список | pgsql-general |
Here's an example using aggregates that's sort of close... SELECT (SELECT COUNT(id) FROM cb_person_plan_enroll WHERE person_id = 72) AS STDPLANS, (SELECT COUNT(id) FROM cb_person_pog_enroll WHERE person_id = 72) AS POGPLANS, (SELECT COUNT(id) FROM cb_person_grp_enroll WHERE person_id = 72) AS GRPPLANS; The problem is that if you dont need an aggregate and the tables nothing in common to join on... you really can't go around joining them if there's nothing to join.... Now -- if you were to create a cursor and select into it from the tables in question... you might get somewhere... "Jean-Christian Imbeault" <jc@mega-bucks.co.jp> wrote in message news:3E39E8A8.7020001@mega-bucks.co.jp... > Sorry for this simple question but I can't seem to get Postgres to do > what I want ... > > I want to get the concatenation of 2 or more tables with absolutely > nothing in common. How can I do this? > > For example > > Table a: > > a > ----- > a1 > a2 > a3 > > Table b: > > b > ----- > b1 > b2 > > Table c: > > c > ----- > c1 > c2 > c3 > c4 > > What is the proper SQL to return: > > a | b | c > --------------- > a1 b1 c1 > a2 b2 c2 > a3 c3 > c4 > > > Thanks, > > Jc > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org
В списке pgsql-general по дате отправления: