Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Search query for Scriptrunner

Mojtaba Mansouri October 21, 2022

I Have linked a field in Jira project to my SQL database for users to pick product names by searching through the data base. The search query that I have used is:

SELECT DISTINCT pname as "TOM", pname FROM db.products
WHERE lower(pname) like concat(lower(?), '%')

 

The query works fine but the issue is in the field it searching match anything starting with typed characters. However, I am looking for a way to search for string regardless of their location. For example if user types: “Head” the search shows: “booklet Head John”.

2 answers

0 votes
Mojtaba Mansouri November 13, 2022

Thanks Sayed, I realized following modification would help with my issue:

#Search:
SELECT DISTINCT ID, pname FROM db.products WHERE lower(pname) like concat( '%', lower (?)  , '%')
0 votes
Sayed Bares _ServiceRocket_
Community Champion
October 23, 2022

Welcome to the community Mojtaba!

Something like this should work:

SELECT DISTINCT pname as "TOM", pname FROM db.products
WHERE lower(pname) like "%head%"

Hope it helps! 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events