Subject RE: [firebird-support] Is this legal SQL?
Author Henrik Sitter
Thx for your reply Helen!

But I don't think the offered solution will do the trick... I'll
elaborate a bit just in case you (or others) have a bit more time to
spare (I probably should buy myself a sql book).

Lets say I have:
***select 1 from table1 where col1 = 'aValue' and col2 = 'bValue'
Both col1 and col2 belong to table1.

But then I decide that col1 can be any value in an array, and this array
is built from a subquery. Then I get:
select 1 from table1 where col1 in < subquery > and col2 = 'bValue'

It's this construct I'm wondering about. Both col1 and col2 still belong
to table1. The way I read your solution col2 (i.e. HISTORIE) belongs to
the subquery table (TABLE).

Henrik :)

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: 25. januar 2004 22:06
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Is this legal SQL?

At 09:07 PM 25/01/2004 +0100, you wrote:
>There was a mistake in the first post....This is the sql I intended to
>ask about:
>
>if (exists (select 1 from TABLEONE
> where COL_IN_TABLEONE in(select COL_IN_TABLEONE from TABLE
>where (COL_IN_TABLETWO = "aValue"))
> and HISTORIE > 0 )
> ) then
>begin
>.
>.
>.
>end

if (COL_IN_TABLEONE = ANY(
SELECT COL_IN_TABLEONE FROM TABLE
WHERE COL_IN_TABLETWO = 'aValue'
AND HISTORIE > 0)) then

/hb





Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/