Solved

Spiceworks SQL Lite query help

Posted on 2013-05-28
2
393 Views
Last Modified: 2013-06-17
In 6.2 they changed some of the tables and now I can't get this query to work.

  Select "1. Global" as "Site","1.6. Hours spent on maintenance this week" as "Category",(sum(ticket_work.time_spent)/3600) ||'h '|| ((sum(ticket_work.time_spent)%3600)/60) ||'m' as "Total"
  from tickets, ticket_work
  where (tickets.created_at>=date('now','-7 days')) and (category='Maintenance')

Open in new window


They moved time_spent into another table.
0
Comment
Question by:ats2012
  • 2
2 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 39203520
try this:
SELECT "1. Global" AS "Site"
	, "1.6. Hours spent on maintenance this week" AS "Category"
	, (sum(ticket_work.time_spent) / 3600) || 'h ' || ((sum(ticket_work.time_spent) % 3600) / 60) || 'm' AS "Total"
FROM tickets
INNER JOIN [ticket_work] ON [tickets].[id] = [ticket_work].[ticket_id]
WHERE (
		tickets.created_at >= DATE (
			'now'
			, '-7 days'
			)
		)
	AND (category = 'Maintenance')

Open in new window

0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39253009
Hi - how did you go with this query?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now