how to make 2 parameters same? - Programmers Heaven

Howdy, Stranger!

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

Categories

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.