We help IT Professionals succeed at work.
Get Started

Strange SQL Query Issue

303 Views
Last Modified: 2016-12-08
I am querying my company's Atlassian JIRA tracking system and reporting on trouble tickets by status assigned to the username "tristanboughton." I have tried writing and re-writing the query multiple times and get one of two results: (1) all tickets (regardless of whether or not they were originally) are displayed as assigned to "tristanboughton" or (2) all tickets, despite filters applied to only display issues assigned to "tristanboughton," are displayed, including ones assigned to other users.

What am I missing?
SELECT     CASE PROJECT WHEN '10180' THEN 'Corporate Applications' WHEN '10160' THEN 'Corporate Reporting' WHEN '10182' THEN 'CMMI' WHEN '10100' THEN
                       'Information Technology Office' WHEN '10230' THEN 'Domain Controller/Migration' END AS ProjectName, REPORTER, ASSIGNEE, 
                      CASE issuetype WHEN '1' THEN 'Product Defect' WHEN '3' THEN 'Task' WHEN '4' THEN 'Risk' WHEN '20' THEN 'Report' WHEN '21' THEN 'Change' WHEN
                       '22' THEN 'Customization' WHEN '23' THEN 'Updated' WHEN '24' THEN 'Research' WHEN '25' THEN 'Applications Issue Type' WHEN '26' THEN 'Enhancement'
                       END AS IssueTypeDef, SUMMARY, DESCRIPTION, 
                      CASE PRIORITY WHEN '1' THEN 'Very High' WHEN '2' THEN 'High' WHEN '3' THEN 'Moderate' WHEN '4' THEN 'Low' WHEN '5' THEN 'Very Low' END AS
                       IssuePriority, PRIORITY, 
                      CASE issuestatus WHEN '1' THEN 'Open' WHEN '3' THEN 'In Progress' WHEN '4' THEN 'Reopened' WHEN '5' THEN 'Resolved' WHEN '6' THEN 'Closed'
                       END AS IssueStatusName, CREATED, UPDATED, DUEDATE, ID, PROJECT, TIMESPENT, issuetype, issuestatus
FROM         jiraissue
WHERE     (PROJECT = '10180') AND (ASSIGNEE = 'tristanboughton') OR
                      (PROJECT = '10160') AND (ASSIGNEE = 'tristanboughton') OR
                      (PROJECT = '10182') AND (ASSIGNEE = 'tristanboughton') OR
                      (PROJECT = '10100') AND (ASSIGNEE = 'tristanboughton') OR
                      (PROJECT = '10230') AND (issuetype <> '12') AND (issuestatus IN (@StatusParameter)) AND (ASSIGNEE = 'tristanboughton')
ORDER BY ProjectName, PRIORITY

Open in new window

Comment
Watch Question
Web Developer, specialising in WordPress
CERTIFIED EXPERT
Most Valuable Expert 2011
Commented:
This problem has been solved!
Unlock 2 Answers and 42 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE