Click here to Skip to main content
16,005,491 members
Home / Discussions / Database
   

Database

 
AnswerRe: Unsigned data type. Pin
TheFM23421-Aug-08 8:10
TheFM23421-Aug-08 8:10 
AnswerRe: Unsigned data type. Pin
shubhi28-Aug-08 23:01
shubhi28-Aug-08 23:01 
QuestionSuggestion is needed in sql server 2000 Database Pin
Rameez Raja20-Aug-08 17:27
Rameez Raja20-Aug-08 17:27 
AnswerRe: Suggestion is needed in sql server 2000 Database Pin
Mycroft Holmes20-Aug-08 18:59
professionalMycroft Holmes20-Aug-08 18:59 
AnswerRe: Suggestion is needed in sql server 2000 Database [modified] Pin
Blue_Boy20-Aug-08 21:18
Blue_Boy20-Aug-08 21:18 
AnswerSQL Server Profiler Pin
David Mujica21-Aug-08 4:56
David Mujica21-Aug-08 4:56 
AnswerRe: Suggestion is needed in sql server 2000 Database Pin
shubhi25-Aug-08 23:48
shubhi25-Aug-08 23:48 
QuestionT-SQL Help [modified] Pin
Hulicat20-Aug-08 7:47
Hulicat20-Aug-08 7:47 
SQL 2005 Standard SP1

I have these two queries I am trying to join into one result set; I have been struggling with this for days and get close but can not seem to get it correct.

Query 1:
select count(*) as 'Total Tickets Assigned' , location_name 'Cient'
from job_ticket j
inner join priority_type p on p.priority_type_id = j.priority_type_id
inner join tech t on t.client_id = j.assigned_tech_id
inner join location l on l.location_id = j.location_id
WHERE Report_Date >= DATEADD(dd,-7,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112))) AND
Report_Date < DATEADD(dd,1,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112)))
group by l.location_name

Query 2:
select count(*) as 'Total Closed for Range'
, location_name 'Cient'
from job_ticket j
inner join priority_type p on p.priority_type_id = j.priority_type_id
inner join tech t on t.client_id = j.assigned_tech_id
inner join location l on l.location_id = j.location_id
where (last_status_update_time >= DATEADD(dd,-7,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112))) AND
Report_Date < DATEADD(dd,1,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112))) ) and
status_type_id ='3'
group by l.location_name




basically all I need to get is the "count(*) as 'Total Closed for Range'" into query 2, however; I keep getting the total in each row rather than the total for each client.


Also I have been trying to send the results of the query out via email.....I know this should be simple but I keep getting errors on that as well.

Any help would be greatly appreciated.

Thanks,

Dennis

Regards,
Hulicat

modified on Wednesday, August 20, 2008 1:53 PM

AnswerRe: T-SQL Help Pin
Blue_Boy20-Aug-08 8:21
Blue_Boy20-Aug-08 8:21 
GeneralRe: T-SQL Help Pin
Hulicat20-Aug-08 9:24
Hulicat20-Aug-08 9:24 
AnswerRe: T-SQL Help Pin
TheFM23420-Aug-08 11:59
TheFM23420-Aug-08 11:59 
GeneralRe: T-SQL Help Pin
Hulicat20-Aug-08 12:52
Hulicat20-Aug-08 12:52 
GeneralRe: T-SQL Help Pin
TheFM23420-Aug-08 16:01
TheFM23420-Aug-08 16:01 
GeneralRe: T-SQL Help Pin
Hulicat20-Aug-08 16:34
Hulicat20-Aug-08 16:34 
QuestionVB.net mysql subtract value Pin
Pestinha198420-Aug-08 6:11
Pestinha198420-Aug-08 6:11 
AnswerRe: VB.net mysql subtract value Pin
Blue_Boy20-Aug-08 8:24
Blue_Boy20-Aug-08 8:24 
GeneralRe: VB.net mysql subtract value Pin
Pestinha198420-Aug-08 10:49
Pestinha198420-Aug-08 10:49 
GeneralRe: VB.net mysql subtract value Pin
Blue_Boy20-Aug-08 14:05
Blue_Boy20-Aug-08 14:05 
QuestionPackages in SQL server 2005 Pin
geekfromindia20-Aug-08 5:44
geekfromindia20-Aug-08 5:44 
AnswerRe: Packages in SQL server 2005 Pin
DerekFL20-Aug-08 6:07
DerekFL20-Aug-08 6:07 
Questionmysql data type Pin
dianenacario20-Aug-08 1:34
dianenacario20-Aug-08 1:34 
AnswerRe: mysql data type Pin
TheFM23420-Aug-08 7:13
TheFM23420-Aug-08 7:13 
QuestionA question about the DB construction Pin
makumazan8420-Aug-08 1:00
makumazan8420-Aug-08 1:00 
AnswerRe: A question about the DB construction Pin
TheFM23420-Aug-08 7:22
TheFM23420-Aug-08 7:22 
GeneralRe: A question about the DB construction Pin
makumazan8420-Aug-08 8:46
makumazan8420-Aug-08 8:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.