/build/static/layout/Breadcrumb_cap_w.png

K1000 custom ticket rule that only runs in one queue

I have several queues in our K1000 and I am new to SQL of any variety.  I am trying to have a ticket rule that will populate parent ticket fields into child ticket fields for a new process, but I want to limit this rule to only a single queue.  During my testing a have been able to select and update from parent to child mostly due to http://www.itninja.com/user/jverbosk many posts and blogs on the topic.  So many thanks to him for getting me this far.

My problem is that when I run the rule, which is located in the queue both the parent and child will live in, this runs in all queues.  Luckily I don't have many parent/child tickets out there so I only botched a few older tickets of little consequence.  Based on some posts from 2012 and 2013 I am using HD_TICKET.HD_QUEUE_ID = 3 to try to select only this one queue, but I get an error that states "Error Code: 1054. Unknown column 'HD_TICKET.HD_QUEUE_ID' in 'where clause' "  It doesn't matter which queue I try, and I have verified this queue number several times.  Same error in MySQL Workbench and my K1000.

Here is my code:

SELECT PARENT.HD_IMPACT_ID, CHILD.HD_IMPACT_ID
FROM HD_TICKET PARENT, HD_TICKET CHILD
WHERE ((HD_TICKET.HD_QUEUE_ID = 3) and PARENT.ID = CHILD.PARENT_ID)

Any help would be greatly appreciated.




1 Comment   [ + ] Show comment
  • Being a complete newb with this, I didn't realize I had an alias since there was no AS statement. But once I look at what chucksteel said it does make sense that it was aliased. My query now works on only the one queue.

    Clearly I need to continue learn this language and try to get a better grip. - Lockdown84 8 years ago

Answers (2)

Answer Summary:
Posted by: chucksteel 8 years ago
Red Belt
1

Top Answer

You have aliased the HD_TICKET table as PARENT and CHILD so when referencing those tables you need to use the alias. In your where clause use PARENT.HD_QUEUE_ID=3. 

Posted by: SMal.tmcc 8 years ago
Red Belt
0
you may need a join

like

JOIN HD_QUEUE Q ON Q.ID = HD_TICKET.HD_QUEUE_ID WHERE (HD_TICKET.HD_QUEUE_ID = 1)

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ