Solved

Spiceworks SQL Lite query help

Posted on 2013-05-28
2
389 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

747 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

10 Experts available now in Live!

Get 1:1 Help Now