Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
how to make 2 parameters same? Posted by jackj on 4 Feb 2005 at 10:54 PM
in an AdoQuery, my sql is:
select id from table1
where name = :aName
union
select id from table2
where name = :aName

and in the object inspector, I got 2 'aName' parameters in Parameters
property altough the name is same.
my question is: how to make them into one parameter?

thanks a lot

jack


Report
Re: how to make 2 parameters same? Posted by rajsha on 5 Feb 2005 at 11:07 AM
: in an AdoQuery, my sql is:
: select id from table1
: where name = :aName
: union
: select id from table2
: where name = :aName
:
: and in the object inspector, I got 2 'aName' parameters in Parameters
: property altough the name is same.
: my question is: how to make them into one parameter?
:
: thanks a lot
:
: jack
:
:
:
Try
select id
from table1, table2
where name = :aName
And
Table1.name = Table2.name
You may need some correction in syntax
Report
Re: how to make 2 parameters same? Posted by Masterijn on 6 Feb 2005 at 9:08 AM
: : in an AdoQuery, my sql is:
: : select id from table1
: : where name = :aName
: : union
: : select id from table2
: : where name = :aName
: :
: : and in the object inspector, I got 2 'aName' parameters in Parameters
: : property altough the name is same.
: : my question is: how to make them into one parameter?
: :
: : thanks a lot
: :
: : jack
: :
: :
: :
: Try
: select id
: from table1, table2
: where name = :aName
: And
: Table1.name = Table2.name
: You may need some correction in syntax
:
That would be a total different query.
If you're using a sql-server db than you can make a stored procedure with 1 parameter, used twice. Otherwise it isn't possible, having two parameters with the same value isn't that ugly.





 

Recent Jobs