Re: Select clause in JOIN statement
| От | Andreas Joseph Krogh |
|---|---|
| Тема | Re: Select clause in JOIN statement |
| Дата | |
| Msg-id | OrigoEmail.41.ba27c9209458fd4c.13f4185bf48@prod2 обсуждение исходный текст |
| Ответ на | Re: Select clause in JOIN statement (Luca Vernini <lucazeo@gmail.com>) |
| Список | pgsql-sql |
På fredag 14. juni 2013 kl. 01:10:51, skrev Luca Vernini <lucazeo@gmail.com>:
It works.
Also consider views.
Just used this on a my db:
SELECT * FROM tblcus_customer
INNER JOIN
( SELECT * FROM tblcus_customer_status WHERE status_id > 0) AS b
ON tblcus_customer.status = b.status_id
This query is the same as a normal JOIN:
SELECT *
FROM tblcus_customer
INNER JOIN
tblcus_customer_status b
ON tblcus_customer.status = b.status_id AND b.status_id > 0
or
SELECT *
FROM tblcus_customer
INNER JOIN
tblcus_customer_status b
ON tblcus_customer.status = b.status_id
WHERE b.status_id > 0 But you can JOIN on SELECTs selecting arbitrary stuff.--
Andreas Joseph Krogh <andreak@officenet.no> mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
Andreas Joseph Krogh <andreak@officenet.no> mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
В списке pgsql-sql по дате отправления: