select with field

i use this select:
/**

  • Selecting a field from another table
    */

// Check for record
$check_sql = “SELECT
termine_pagamento
FROM
clienti
WHERE
(id = ‘{id}’)”;
sc_lookup(rs, $check_sql);

if (isset({rs[0][0]})) // Row found
{
{modalita_pagamento} = {rs[0][0]};

}
else // No row found
{
{modalita_pagamento} = ‘’;

}

my primary key is id, but want change with another field is possible? example:
new field test is not primay key:
/**

  • Selecting a field from another table
    */

// Check for record
$check_sql = “SELECT
termine_pagamento
FROM
clienti
WHERE
(test = ‘{id}’)”;
sc_lookup(rs, $check_sql);

if (isset({rs[0][0]})) // Row found
{
{modalita_pagamento} = {rs[0][0]};

}
else // No row found
{
{modalita_pagamento} = ‘’;

}

In general you can use any sql statement you like/need. No matter how complex. I would leave out the () btw.