i'm looking for the TracQuery for the trac report to get all tickets without assigned milestone listed. have you already composed this query, if yes, would you share it? thx in advance.
Something like this should do it, adapt to suit your precise needs....
SELECT
id AS ticket,
datetime(time,'unixepoch'),
summary,
status,
priority,
description AS _description
FROM ticket t
WHERE t.milestone is NULL AND t.status<>'closed'
ORDER BY time desc, status, severity, summary
The key part for you is simply to filter on the milestone being NULL.
I could reproduce the 'No matches found' for the answer by Paul Dixon, so I tried it on my own:
SELECT
id AS ticket,
time AS date,
summary,
status,
priority,
description AS _description
FROM ticket t
WHERE t.milestone not in (
SELECT name
FROM milestone
)
AND t.status<>'closed'
ORDER BY time desc, status, severity, summary
Note: Trac has some "magic" result table column names. Assigning 'date' will do the appropriate conversation of time stamp integer to date string automagically - even better - respecting the current internal Trac time stamp format of POSIX micro-seconds (since Trac 0.12) too. In this respect the SQL statement above is even the most portable solution I'm aware of.
This is quite simple using Trac's query language instead of raw SQL. On a wiki page, you can use query:milestone= to create a link to a query of all tickets without a milestone assigned. Invoke the macro [[TicketQuery(milestone=)]] to insert the list of matching tickets into the wiki page.
To do the same thing on the "Custom Query" page, remove all search criteria and add a single criteria of "milestone" "is" and leave the third field blank.
Related
I don't mean a statement that has a starttime as a qualifier added.
Im interested to know if there is a way to find the date from when a user added a statement.
For example, Tiger Woods: Q10993
Through the revision history tab, you can see the date that a specific statement is added.
I wonder if it's possible to query this information.
Sql question.
I have a customer table with:
User id, name, email, phone
The customer can update their name, email and phone at anytime on an app.
How can I find out which user id had changes in name, email or phone number on a particular date?
Since your table doesn't store the date that they made the changes, you can't.
If you add a column with a datetime type (or whatever your specific database product provides) - you could call it LastModified or something like that - then the solution becomes trivial.
I'd give you a specific example, but because you didn't tell us what database engine you use, I can't guarantee to get the syntax right.
This is an issue with RDBMSes, you cannot as they generally store say a "photograph" of your data in time not a "film" of how it got there.
Based on the RDBMS you use, you can introduce an updated_at field which will hold when the last change happened to that row either from the "UPDATE" statement (say 'UPDATE phone=000, updated_at=now() WHERE user_id=999') or set it up to autoupdate see: create column for auto-date in postgresql
I'd like to exclude issues who have a given status based on the current date, but can't figure out how to do it with startOfWeek() now() etc. Because those must filter on an issue field.
Eg:
AND NOT (status IN ("In review") AND now() BETWEEN (startOfWeek(-2), startOfWeek(1)))
Is there a trick that I can use to get the current time from an issue field? Eg some issue field that is aliased to now()?
You most probably need changed operator. This will filter out all the issues with status In Review that were changed:
status in ("In review") AND status changed DURING (startOfWeek(-2), startOfWeek(1))
You could use updateDate if you want to check for the issues that have been updated in that time period and are in the given status.
If you want to check for the date of the transition into this status, this is a bit more involved. Could you elaborate what you actually need to have happened in this time period for the issues to qualify if updatedDate doesn't do the trick?
I'm in the process of building a database to keep track of loaning equipment. I'm trying to build a query that will display the latest record of each machines location.
Relevant table is:
Movements:
Movement ID (PK)
EntryDate (Automatically generated on record entry)
Serial (FK from a table called stock, with (Make, Model etc)
Location (Where the machine is)
Status (Things like: Available, Testing, Sold etc)
Current query is:
SELECT Movements.Serial, Max(Movements.EntryDateMovements) AS MaxOfEntryDateMovements
FROM Movements
GROUP BY Movements.Serial;
Which spits out the latest date of a record, and the serial associated with it.
What I need is the status to be shown in the results, but it still be grouped by the serial.
My issue is that when I try and add that, it either comes back with an error with about the expression not being part of the aggregate function, or I get more results than expected, as it no longer just keeps the results unique to the serial.
I'm pretty new Access, and have so far been able to muddle through guides, and books, and this site, to get everything else working, but i'm stuck at this hurdle.
Any help would be much appreciated.
Select top 1 *
from Movements
order by EntryDateMovements desc
This will give you everything for the newest record. This is TSQL but I think it carries over to Access.
Try this
Select t.serial,t.EntryDateMovements ,t.location, t.status
From movements as t
Inner join (SELECT Movements.Serial, Max(Movements.EntryDateMovements) AS MaxOfEntryDateMovements
FROM Movements
GROUP BY Movements.Serial) as MaxMovements on t.serial= MaxMovements.serial and t.EntryDateMovements=MaxMovements.MaxOfEntryDateMovements
I want to pull out month-by-month stats from a jira project, which shows the number of tickets that were in each state at the start of each month (similar to the Cummulative Flow Diagram, but extractable).
Is there a way in JQL or SQL to get the status of all tickets in a project at a specific point in time?
If you want to do this via SQL for one specific date, Atlassian provides instructions for related useful queries on JIRA 4.x. A particularly-relevant one would seem to be the "Find Statuses of all issues in a project on a given date" query, but it will be a bit of an uphill battle to do this over a varying date range.
These queries are still mostly relevant for more modern versions of JIRA, with the main concern being that the JI.pkey column will be blank in JIRA 6+. To get this data back, you first need to join with the project table with ON project.id=JI.project, and then synthesize the issue key yourself as P.pkey || '-' || JI.issuenum. You will also probably need to apply typecasts to some of the joins (at least on some databases) since a few joins are trying to relate integer-typed columns with text columns.
For reference, their JIRA 4.x query was the following:
SELECT JI.pkey, STEP.STEP_ID
FROM (SELECT STEP_ID, ENTRY_ID
FROM OS_CURRENTSTEP
WHERE OS_CURRENTSTEP.START_DATE < '<your date>'
UNION SELECT STEP_ID, ENTRY_ID
FROM OS_HISTORYSTEP
WHERE OS_HISTORYSTEP.START_DATE < '<your date>'
AND OS_HISTORYSTEP.FINISH_DATE > '<your date>' ) As STEP,
(SELECT changeitem.OLDVALUE AS VAL, changegroup.ISSUEID AS ISSID
FROM changegroup, changeitem
WHERE changeitem.FIELD = 'Workflow'
AND changeitem.GROUPID = changegroup.ID
UNION SELECT jiraissue.WORKFLOW_ID AS VAL, jiraissue.id as ISSID
FROM jiraissue) As VALID,
jiraissue as JI
WHERE STEP.ENTRY_ID = VALID.VAL
AND VALID.ISSID = JI.id
AND JI.project = <proj_id>;
If you are open to using a commercial add-on, Arsenale Dataplane can do exactly what you want in a few clicks using the Issue Values Snapshots by Date report. Disclaimer: I work for the company that makes this product.
With JQL you can only look for Issues not for States. About the specific point of time, you can only get information about the current status, unless you develop a complex script that takes in account the current situation and the changes made after the date you want to check (ChangeHistoryManager).
On the other hand, you can configure a Board with a pie chart (in example), where you set the Status field to be shown. Additionaly, you can create a Notification so that each first of month you get an email with this information.
Probably more interesting the scripting solution, but absolutely longer in time, and more complex.
Regards