Subject | RE: [firebird-support] SQL |
---|---|
Author | mohamed hamza |
Post date | 2019-08-30T22:39:02Z |
What do you think about creating view? ( ex :viewAge ) and then we can write
select * from viewAge where state='CA'
De : firebird-support@yahoogroups.com <firebird-support@yahoogroups.com> de la part de Richard Damon richard@... [firebird-support]
<firebird-support@yahoogroups.com>
Envoyé : mercredi 28 août 2019 05:27
À : firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Objet : Re: [firebird-support] SQL
Envoyé : mercredi 28 août 2019 05:27
À : firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Objet : Re: [firebird-support] SQL
On 8/5/19 4:20 AM, mohamed hamza medhome@... [firebird-support]
wrote:
>
>
> Hi All,
>
> I am new to sql, I am coming from Xbase system .
> I want to know if it 's possible to execute query using last query
> result?
>
> EXAMPLE
>
> 1 select * from persons where state='CA'
>
> 2 select * from persons where age> 18 but we have to use the
> result of 1
>
> I DO NOT WANT TO DO AN AND ( STATE = 'CA' AND AGE > 18 ) ;
>
> Best Regards
Maybe something like:
SELECT * FROM ( SELECT * FROM persons where state = 'CA') where age > 18;
But using AND will generally be faster.
As far as I know, you can't just reference the previous query, unless
you explicitly put that result into a temporary table.
--
Richard Damon