Re: [firebird-support] What the best way to to join 2 tables accross 2 databases ?

2012-03-18 Thread Helen Borrie
At 02:19 PM 19/03/2012, Alexandre Benson Smith wrote:

>You can do cross database joins using execute statement in FB 2.5.

It's true that you can perform DML in an external database from within a PSQL 
module in v.2.5, using the EXECUTE STATEMENT extensions.  But, no, you can't do 
cross-database joins in Firebird at all.  It won't happen until Firebird 
supports database namespaces, which is not yet.

./heLen



Re: [firebird-support] order by using parameter of stored procedure

2012-03-18 Thread Helen Borrie
At 09:26 AM 19/03/2012, Newbie wrote:
>How to best implement ORDER BY of a query when the field by which to 
>order, is given as stored procedure input parameter?

It is not possible to that directly, as ORDER BY is a structural element that 
is pre-compiled.

>for example a typical product list where could be ordered by Name, Price 
>etc fields depending on what user clicks.
>
>I tried to include it into query:
>
>for
>select f1, f2 from t1
>order by :order_by_field
>into :p1, :p2
>
>I am not getting any errors, but it doesn't order the list. how to do it 
>better?

Use EXECUTE STATEMENT.  Look up the Language Reference Update document for your 
version of Firebird to see how this is achieved.  You should find it in the 
../doc/ subdirectory of your installation;  if not, you can download it from 
the Firebird website documentation area.

./heLen



Re: [firebird-support] What the best way to to join 2 tables accross 2 databases ?

2012-03-18 Thread Alexandre Benson Smith
Em 18/3/2012 16:59, nathanelrick escreveu:
> hello,
>
> What the best way to to join 2 tables accross 2 databases ?
>
> actually i do on the 1rt database a select First 100 ID from myTable1 where 
> ... and in the seconde database select * from MyTable2 where ID in 
> ()
>
> but the problem, the select * from MyTable2 where ID in 
> () is very slow, especially on the 
> prepare :(
>
> is their any better way ?
>

You can do cross database joins using execute statement in FB 2.5.

Take a look on the release notes.

see you !


[firebird-support] order by using parameter of stored procedure

2012-03-18 Thread Newbie
How to best implement ORDER BY of a query when the field by which to 
order, is given as stored procedure input parameter?
for example a typical product list where could be ordered by Name, Price 
etc fields depending on what user clicks.

I tried to include it into query:

for
select f1, f2 from t1
order by :order_by_field
into :p1, :p2

I am not getting any errors, but it doesn't order the list. how to do it 
better?
thanks.


[firebird-support] What the best way to to join 2 tables accross 2 databases ?

2012-03-18 Thread nathanelrick
hello,

What the best way to to join 2 tables accross 2 databases ?

actually i do on the 1rt database a select First 100 ID from myTable1 where ... 
and in the seconde database select * from MyTable2 where ID in 
()

but the problem, the select * from MyTable2 where ID in 
() is very slow, especially on the 
prepare :(

is their any better way ?