Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7786985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:31:36+00:00 2026-06-01T20:31:36+00:00

Latest PHP under WAMPserver SQL Server 2005 The user passes two variables to my

  • 0

Latest PHP under WAMPserver

SQL Server 2005

The user passes two variables to my .php report page, $thedate1 and $thedate2 which are a start and end datetime stamp for the values I want to retrieve from the database. I aggregate the data and pivot it on a SUM function to get the report I want, but I don’t know how to include all the days inbetween the date range to appear as individual columns in the final report.

So if $thedate1=’2012-02-20′ and $thedate2=’2012-02-28′ I want to have a column for each day inbetween (inclusive) to be created dynamically in the final report. Currently I have to add the dates by hand into the query, but I’m hoping there’s a way to add them in automatically.

Any ideas?

WITH T 
AS(
    SELECT CorrectionUser, CorrectionsCount, 
    DATEADD(dd, DATEDIFF(d, 0, DateHourCorrected), 0) as [DATE]
    FROM ISIImageCorrections
)
SELECT CorrectionUser AS [Employee], 
       COALESCE([2012-02-20], 0) AS [2012-02-20],
       COALESCE([2012-02-21], 0) AS [2012-02-21],
       COALESCE([2012-02-22], 0) AS [2012-02-22]
FROM T
PIVOT(SUM(CorrectionsCount) FOR [Date] IN([2012-02-20], [2012-02-21], [2012-02-22]))
AS P
ORDER BY CorrectionUser
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:31:38+00:00Added an answer on June 1, 2026 at 8:31 pm
    if OBJECT_ID('tempdb..#t1') is not null DROP TABLE #t1;
    CREATE TABLE #t1 (d date NOT NULL);
    
    DECLARE @start date;
    SET @start = '2012-04-05';
    DECLARE @end date;
    SET @end = '2012-04-25';
    WHILE (@start <= @end)
    begin
        INSERT INTO #t1 VALUES(DATEADD(day, 1, @start));
        SET @start = DATEADD(day, 1, @start);
    end;
    
    SELECT * FROM #t1;
    DROP TABLE #t1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to connect to a SQL Server 2008 through PHP (WAMP, latest version).
I am using latest PHP. I want to parse HTML page to get data.
I've heard the latest PHP has support for namespaces. I know variables defined in
I'm using the latest PHP SDK and have tried $facebook->('/me/friends?fields=installed') and it tells me
How to get latest order No. from onepageController.php in checkout module in Magento? Or
I'm using XAMPP (latest version) on OS 10.6.2, that's bundled with PHP 5.3.0 I
This is what i want to do: I want /summary.php to include 5 latest
I think I may have found a bug in PHP's crypt() function under Windows.
I've been trying to create a button within a php page called by ajax
First some basic info: Ubuntu latest version Zend Framewrok 1.9.6 Doctrine 1.2.1 Php unit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.