Subject RE: FW: [firebird-support] Is this legal SQL?
Author Henrik Sitter
Hi!

Well, I actually think my construct is easier to read (must be something
wrong with my mind) :).

Now I have two ways to do the same thing (my construct seems to do what
I was hoping for), and I learned some sql. That's good! I don't know
about speed, but the "select 1" probably makes that a non-issue I guess.

Thx a lot for taking the time!
Henrik

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: 26. januar 2004 11:17
To: firebird-support@yahoogroups.com
Subject: Re: FW: [firebird-support] Is this legal SQL?

At 10:23 AM 26/01/2004 +0100, you wrote:
>Hi, Helen and Svein Erling!
>
>Table 1:
>Name -> TABLEONE
>Columns -> ARTNR, HISTORY
>
>Table 2:
>Name -> TABLETWO
>Columns -> ARTNR, COLOR
>
>if (exists (select 1 from TABLEONE
> where ARTNR in (select ARTNR from TABLETWO
> where COLOR = 'aValue')
> and HISTORY > 0
> )
> ) then
>begin
>.
>.
>.
>end

Well, Henrik, I think you are trying to make this far more difficult
than
it is. This is, after all, only an existential test!!

if (exists (select 1 from TABLETWO T2
JOIN TABLEONE T1
ON T1.ARTNR = T2.ARTNR
where T2.COLOR = 'aValue'
and T1.HISTORY > 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/