Mysql Query help
Need help on Mysql Query
Any query to pull SUBMITTER name appear in Helpdesk page into this below query
select USER_NAME from USER where FULL_NAME like '%SUBMITTER%'
If User name is ALEX . I want to replace the query as below
select USER_NAME from USER where FULL_NAME like 'ALEX'
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
nshah
8 years ago
Your question is missing some parts to it. Are you looking for any tickets opened by someone with the name Alex as their full name? This will get you all tickets submitted by anyone with the name alex. If you need something else, please explain your question in more detail.
Select
HD_TICKET.TITLE,
USER.FULL_NAME
From
HD_TICKET Inner Join
USER
On USER.ID = HD_TICKET.SUBMITTER_ID
WHERE User.full_name rlike 'alex'
Comments:
-
thanks, nshah... We have two entries for each user in USER Table.. One row has AD name and other has Lotus notes email ID, only way I can pull AD/Email id details is by using Full Name of the user..Both row has same Full name entries
I want to pull user details in ticketing page from USER table when SUBMITTER name in ticketing page and FULL NAME in USER table matches
USER table entries
ID USER_NAME EMAIL FULL_NAME
2289 mathewj mathewj@gccx.COM Mathew JOSE
40524 mathewjose@FR.COM mathewjose@FR.COM Mathew JOSE
screen shot of table here
http://cubeupload.com/im/ABK0JB.jpg - rahimpal 8 years ago
Posted by:
JasonEgg
7 years ago
I still don't exactly understand what you want to do, but here is some code to get you started. Replace "TICKET_FIELD" and "USER_FIELD" with the appropriate column names for your environment.
!!!WARNING!!! Custom Ticket Rules are DANGEROUS: use a test environment, or at least in a test queue with test tickets, before putting anything in production.
Select:
HD_TICKET.ID AS ID,
USER.ID AS USER_ID
FROM HD_TICKET
JOIN USER ON (USER.ID = HD_TICKET.SUBMITTER_ID)
JOIN USER ON (USER.ID = HD_TICKET.SUBMITTER_ID)
WHERE HD_TICKET.[TICKET_FIELD] = ''
NOTE: you may not need that final line (or you may want to include more conditions),
depending on whether or not the field will ever be filled by a submitter or owner
Update:
UPDATE HD_TICKET
JOIN USER ON (USER.ID = T.SUBMITTER_ID)
SET T.[TICKET_FIELD] = U.[USER_FIELD]
WHERE T.ID IN (<TICKET_IDS>)
JOIN USER ON (USER.ID = T.SUBMITTER_ID)
SET T.[TICKET_FIELD] = U.[USER_FIELD]
WHERE T.ID IN (<TICKET_IDS>)
Frequency: "On Ticket Save"