Vitali Lovich wrote:
The solution I came up with is:
SELECT coalesce(
(SELECT field1 FROM tbl1 WHERE key = $key),
(SELECT field1 FROM tbl2 WHERE key = $key),
(SELECT field1 FROM tbl3 WHERE key = $key))
, field2 FROM tbl1 WHERE key = $key;
However, if
coalesce works the way I think it does, then
Dan Kennedy wrote:
On Fri, 2007-05-04 at 18:22 -0400, Vitali Lovich wrote:
Multiple tables contain a primary key KEY. If Table1 contains a
matching KEY, then I want that row from Table1. Only if it isn't in
Table1, then look in Table2 if it is there. If not in Table2 go on to
Table3, etc
On Fri, 2007-05-04 at 18:22 -0400, Vitali Lovich wrote:
> Hi,
>
> I was wondering what would be the optimal way to select 1 matching row
> from multiple tables. Here is the scenario.
>
> Multiple tables contain a primary key KEY. If Table1 contains a
> matching KEY, then I want that row from
Hi,
I was wondering what would be the optimal way to select 1 matching row
from multiple tables. Here is the scenario.
Multiple tables contain a primary key KEY. If Table1 contains a
matching KEY, then I want that row from Table1. Only if it isn't in
Table1, then look in Table2 if it is t
4 matches
Mail list logo