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

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.