Solved

Spiceworks SQL Lite query help

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server Designer 19 39
Help Required 3 89
Deal with apostrophe in stored procedures 8 40
optimize stored procedure 6 23
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.

816 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

7 Experts available now in Live!

Get 1:1 Help Now