Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to make 2 parameters same?

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


Comments

  • rajsharajsha Posts: 75Member
    : 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
  • MasterijnMasterijn Posts: 188Member
    : : 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.


Sign In or Register to comment.