Board index » delphi » Select Statement

Select Statement

Hi,
   I try to run this select statement in interbase, but is fail, it give me
error
Dynamic SQL Error
SQL error code = -104
Token unknown - line 2, char 1
select
Statement:

the select statement is like this:
select a.col2,b.col1 from
 (select col2 from countries)a,
(select col1 from currencies) b
where a.col1 = b.col2;

I want to write a select statement is like a view but i don't want to create
as a view.
Can anyone help me to solve this problem?
TQ

 

Re:Select Statement


try to change it to:

SELECT a.col2, b.col1 FROM
countries a, currencies b
WHERE a.col1 = b.col2;

HTH,

-Jaimy
--
Jaimy Azle | Principle Developer
Center of Computer Development System
Faculty of Economics - Gadjah Mada University
http://www.ppkfeugm.com

Re:Select Statement


Hi, poolan

The SQL statement may work on other database engines ( e.g. Ora~e and M$
SQL ).

But the performance of your SQL statement may be very low because SQL engine
firstly create two dummy tables by ( select col2 from countries ) and
 select col1 from currencies ).  It will create heavy disk I/O overhead and
working storage.  After that, SQL engine join the two dummy tables without
index files by ( where a.col1 = b.col2 ).  Finally, SQL engine select the
columns by ( select a.col2, col1 ).

Although it may get the expected result, there may cause waiting for a long
time and sometimes use all avaliable space of a database's working storage.
It may also hang up the system ( e.g. M$ SQL ), if the size of "countries"
and "currencies" table is large.

Please see some articles about the SQL statement turning or rules ( e.g, Art
of computing ).

Nelson,

-----------------------------------------

"poolan" <pl...@tonecorp.com> ???g??l news:3b563d7f_1@dnews...

Quote
> Hi,
>    I try to run this select statement in interbase, but is fail, it give
me
> error
> Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 2, char 1
> select
> Statement:

> the select statement is like this:
> select a.col2,b.col1 from
>  (select col2 from countries)a,
> (select col1 from currencies) b
> where a.col1 = b.col2;

> I want to write a select statement is like a view but i don't want to
create
> as a view.
> Can anyone help me to solve this problem?
> TQ

Other Threads