AnsweredAssumed Answered

Modify Query Conditions

Question asked by myusufk90 on May 21, 2017
Latest reply on May 22, 2017 by Louis_van_Amelsfort

Hi there,

 

I was recently going through the logs of Service Catalog whilst modifying the policy assignees and found this entry in the log:

 

2017/05/21 14.26.50.701 INFO [http-bio-80-exec-15] [DBDriver] DB-4 | Query 1-100: select distinct c.inactive, c.contact_uuid, c.userid, c.supervisor_contact_uuid, c.last_name, c.first_name, c.middle_name, c.alias, c.pri_phone_number, c.alt_phone_number, c.fax_number, c.mobile_phone_number, c.pager_number, c.email_address, t.name, l.location_name, l.address_1, l.address_2, l.city, l.county, l.fax_number as fax1, l.pri_phone_number as pri_phone_number1, l.location_uuid, l.zip, s.description as state_name, co.name as country_name, c2.userid as manager, t.name as title_name from ca_contact c left outer join ca_location l on c.location_uuid = l.location_uuid left outer join ca_state_province s on l.state = s.id left outer join ca_country co on l.country = co.id left outer join ca_job_title t on c.job_title = t.id left outer join usm_link_account_user au on c.userid = au.user_id left outer join ca_contact c2 on c2.contact_uuid = c.supervisor_contact_uuid left outer join usm_account a on a.account_id = au.account_id where ( c.last_name collate database_default like ? ESCAPE '\' or c.first_name collate database_default like ? ESCAPE '\' ) and c.inactive = 0 order by c.last_name, c.first_name

 

Would it be possible to modify the WHERE clause from "where ( c.last_name collate database_default like ? ESCAPE '\' or c.first_name collate database_default like ? ESCAPE '\' ) and c.inactive = 0 order by c.last_name, c.first_name" to "where ( c.alternate_identifier collate database_default like ? ESCAPE '\' or c.userid collate database_default like ? ESCAPE '\' ) and c.inactive = 0 order by c.last_name, c.first_name"

 

I would also like to include "%"  such as "c.userid collate database_default like ? '%' ESCAPE '%\' "

 

Please let me know your thoughts and/or advice.

 

Kind regards,

Mo

Outcomes