On Sun, 30 Aug 2015 21:26:43 +0200 "R.Smith" <rsmith-A8BYtU+P9sDYkQIYctQFYw at public.gmane.org> wrote:
> 1 - Sub-Queries: > > SELECT A.Data, B.Data, C.Data > FROM (SELECT KeyField, Col1 AS Data FROM someTable WHERE Col1 > > 5) AS A JOIN (SELECT KeyField, Col2 AS Data FROM someTable WHERE > Col2 < 10) AS B JOIN (SELECT KeyField, Col3 AS Data FROM someTable > WHERE Col3 = 20) AS C WHERE A.KeyField = B.KeyField AND B.KeyField > = C.KeyField; > > > 2 - Common table expression (CTE): > > WITH > A(KeyField, Data) AS (SELECT KeyField, Col1 FROM someTable WHERE Col1 > > 5), B(KeyField, Data) AS (SELECT KeyField, Col2 FROM someTable > > WHERE Col2 > < 10), > C(KeyField, Data) AS (SELECT KeyField, Col3 FROM someTable WHERE > Col1 = 20) > SELECT A.Data, B.Data, C.Data > FROM A > JOIN B ON B.KeyField = A.KeyField > JOIN C ON C.KeyField = A.KeyField > ; > > > You could of course add lots of other columns, this just the minimum > to make the idea work. Okay. Thanks for the hint. I think I go for 1. Lev -- 73 de HA5OGL Op.: Levente