Click here to Skip to main content
15,888,019 members
Home / Discussions / Database
   

Database

 
AnswerRe: Using SQL LocalDB Pin
Richard Deeming29-Oct-13 4:51
mveRichard Deeming29-Oct-13 4:51 
GeneralRe: Using SQL LocalDB Pin
GenJerDan29-Oct-13 4:57
GenJerDan29-Oct-13 4:57 
QuestionSQL connection in Visual studio 2012 Pin
Member 1017436328-Oct-13 7:47
Member 1017436328-Oct-13 7:47 
QuestionRe: SQL connection in Visual studio 2012 Pin
Eddy Vluggen28-Oct-13 8:44
professionalEddy Vluggen28-Oct-13 8:44 
AnswerRe: SQL connection in Visual studio 2012 Pin
Member 1017436328-Oct-13 21:08
Member 1017436328-Oct-13 21:08 
AnswerRe: SQL connection in Visual studio 2012 Pin
Richard Deeming28-Oct-13 12:40
mveRichard Deeming28-Oct-13 12:40 
AnswerRe: SQL connection in Visual studio 2012 Pin
Bernhard Hiller29-Oct-13 22:02
Bernhard Hiller29-Oct-13 22:02 
QuestionCTE Query taking too long Pin
Richard.Berry10027-Oct-13 8:03
Richard.Berry10027-Oct-13 8:03 
Hi Below query is taking 10 seconds to return 90 rows.

Using cte to get the dates of the last 90 days, then summing the production for each day (Alloocated is production qty) and DateCreated is a DateTime value that the units were produced.

So the output is the date of the last 90 days, and the total production for each day

Can anyone point out what I am doing wrong?

SQL
;WITH Dates AS
(
    SELECT GETDATE()as DateValue
    UNION ALL
    SELECT DateValue -1
    FROM Dates
    WHERE DateValue -1 >= dateadd(d,-90,GETDATE())
)
SELECT convert(nvarchar(10),DateValue,121) as ProdDate , coalesce(trk.Tot,0)as ProdQty
FROM Dates D
left join (select convert(nvarchar(10),DateCreated,121) as TrkDate ,SUM(allocated) as Tot from vektronix.[dbo].[Tracking] t
where [TrackingTypeId] = '5'
group by convert(nvarchar(10),DateCreated,121)) 
as trk on trk.TrkDate = convert(nvarchar(10),DateValue,121)
group by DateValue, trk.Tot
order by datevalue desc
OPTION (MAXRECURSION 32747)

AnswerRe: CTE Query taking too long Pin
Mycroft Holmes27-Oct-13 13:06
professionalMycroft Holmes27-Oct-13 13:06 
GeneralRe: CTE Query taking too long Pin
Richard.Berry10027-Oct-13 18:54
Richard.Berry10027-Oct-13 18:54 
GeneralRe: CTE Query taking too long Pin
Mycroft Holmes27-Oct-13 19:18
professionalMycroft Holmes27-Oct-13 19:18 
GeneralRe: CTE Query taking too long Pin
Richard.Berry10028-Oct-13 8:26
Richard.Berry10028-Oct-13 8:26 
GeneralRe: CTE Query taking too long Pin
Jörgen Andersson28-Oct-13 10:35
professionalJörgen Andersson28-Oct-13 10:35 
GeneralRe: CTE Query taking too long Pin
Richard.Berry10028-Oct-13 18:39
Richard.Berry10028-Oct-13 18:39 
QuestionCount related Pin
Corporal Agarn25-Oct-13 5:37
professionalCorporal Agarn25-Oct-13 5:37 
AnswerRe: Count related Pin
Richard Deeming25-Oct-13 7:47
mveRichard Deeming25-Oct-13 7:47 
GeneralRe: Count related Pin
Corporal Agarn25-Oct-13 8:13
professionalCorporal Agarn25-Oct-13 8:13 
QuestionWhat is the format of the connection string used for mysql database access? Pin
Gbenbam24-Oct-13 15:59
Gbenbam24-Oct-13 15:59 
AnswerRe: What is the format of the connection string used for mysql database access? Pin
PIEBALDconsult24-Oct-13 17:33
mvePIEBALDconsult24-Oct-13 17:33 
AnswerRe: What is the format of the connection string used for mysql database access? Pin
coded00725-Oct-13 3:17
professionalcoded00725-Oct-13 3:17 
QuestionLINQ syntax Pin
vkEE24-Oct-13 3:24
vkEE24-Oct-13 3:24 
QuestionRe: LINQ syntax Pin
thatraja24-Oct-13 3:37
professionalthatraja24-Oct-13 3:37 
AnswerRe: LINQ syntax Pin
vkEE24-Oct-13 3:58
vkEE24-Oct-13 3:58 
GeneralRe: LINQ syntax Pin
Bernhard Hiller24-Oct-13 21:28
Bernhard Hiller24-Oct-13 21:28 
AnswerRe: LINQ syntax Pin
Richard Deeming24-Oct-13 4:25
mveRichard Deeming24-Oct-13 4:25 

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.