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

  • Home
  • SEARCH
  • 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 8395919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:25:00+00:00 2026-06-09T20:25:00+00:00

I recently created a query that compiles successfully and returns the desired result. When

  • 0

I recently created a query that compiles successfully and returns the desired result. When I used that piece of code as a subquery in another piece of code that a user on stackoverflow came up with for me, I encountered a few problems, which were ultimately solved. I attempted to use this query as a subquery in that piece of code given to me. However, sql fiddle doesn’t return anything. No errors or compiled messages. When I tried putting in a syntax error on purpose-like a random + sign, nothing happened. is it because the query is too long?

schema

CREATE TABLE sampleData 
    (
     id MEDIUMINT NOT NULL AUTO_INCREMENT,
      timecode int, 
     count int,
      PRIMARY KEY (id)
    )
#ENGINE=MyISAM
;

INSERT INTO sampleData
(timecode, count)
VALUES
(1344893440, 1), ( 1346014720, 1),( 1344898688,1),( 1345654784,1),( 1345978368,1),
( 1345959296,1), (1345064704,1), ( 1345156352,1),( 1345225600,1),
(1345017984,1),( 1345640960,1),( 1346019968,1),( 1345834752,1),
( 1345438464,1),( 1344986880,1),( 1345045632,1),( 1345557888,1),( 1344973056,1),( 1345087232,1),( 1345433216,1),( 1345691008,1),
( 1344917760,1),( 1345253248,1),( 1344934912,1),( 1345890048,1),( 1345272448,1), (1345829504,1),( 1345798400,1),( 1345203200,1),( 1344741120,1),
( 1345175552,1),( 1344824192,1),( 1344926336,1),( 1345571712,1),( 1344931584,1),( 1345211776,1),( 1345059456,1),( 1345516288,1),( 1345441920,1),( 1346009472,1)

query

select t_0.*,
           (coalesce(t_3.average_number_of_votes_per_previous_period_days, 0) - coalesce(t_4.average_number_of_votes_per_previous_period_days, 0)) * 100.0
    from 
        (select t.*,
           (coalesce(t_1.count, 0) - coalesce(t_2.count, 0)) * 100.0 as "percentage increase in count in %"
    from  
    (
      SELECT sum(1) AS ordr,
      t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"

      FROM 
        (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t1
        INNER JOIN 
        (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t2 
        on t1.day >= t2.day                                                                                                                                
        GROUP BY t1.day, t1.count
        ORDER BY t1.day
        )t 
      left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
            (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t1
          INNER JOIN 
            (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t2 
          on t1.day >= t2.day                                                                                                                                
          GROUP BY t1.day, t1.count
          ORDER BY t1.day
          )t_1
       on t.ordr = t_1.ordr + 1 left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
              (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t1
            INNER JOIN 
              (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t2 
            on t1.day >= t2.day                                                                                                                                
            GROUP BY t1.day, t1.count
            ORDER BY t1.day
            ) t_2
        on t.ordr = t_2.ordr + 2)t_0 
    left outer join
         (select t.*,
           (coalesce(t_1.count, 0) - coalesce(t_2.count, 0)) * 100.0 as "percentage increase in count in %"
    from  
    (
      SELECT sum(1) AS ordr,
      t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"

      FROM 
        (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t1
        INNER JOIN 
        (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t2 
        on t1.day >= t2.day                                                                                                                                
        GROUP BY t1.day, t1.count
        ORDER BY t1.day
        )t 
      left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
            (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t1
          INNER JOIN 
            (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t2 
          on t1.day >= t2.day                                                                                                                                
          GROUP BY t1.day, t1.count
          ORDER BY t1.day
          )t_1
       on t.ordr = t_1.ordr + 1 left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
              (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t1
            INNER JOIN 
              (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t2 
            on t1.day >= t2.day                                                                                                                                
            GROUP BY t1.day, t1.count
            ORDER BY t1.day
            ) t_2
        on t.ordr = t_2.ordr + 2) t_3
         on t.ordr = t_3.ordr + 1 
    left outer join
         (select t.*,
           (coalesce(t_1.count, 0) - coalesce(t_2.count, 0)) * 100.0 as "percentage increase in count in %"
    from  
    (
      SELECT sum(1) AS ordr,
      t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"

      FROM 
        (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t1
        INNER JOIN 
        (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t2 
        on t1.day >= t2.day                                                                                                                                
        GROUP BY t1.day, t1.count
        ORDER BY t1.day
        )t 
      left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
            (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t1
          INNER JOIN 
            (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t2 
          on t1.day >= t2.day                                                                                                                                
          GROUP BY t1.day, t1.count
          ORDER BY t1.day
          )t_1
       on t.ordr = t_1.ordr + 1 left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
              (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t1
            INNER JOIN 
              (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t2 
            on t1.day >= t2.day                                                                                                                                
            GROUP BY t1.day, t1.count
            ORDER BY t1.day
            ) t_2
        on t.ordr = t_2.ordr + 2) t_4
        on t_0.ordr = t_4.ordr + 2
  • 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-09T20:25:02+00:00Added an answer on June 9, 2026 at 8:25 pm

    I’ve plugged your query in this fiddle, and I now see the problem. Your query is over 8000 characters long (8423 to be exact), and I’m not showing that message on the result panel. Basically, this is a display bug in SQL Fiddle that I’ve not noticed before (so, thanks for bringing this to my attention!).

    In the mean time, you could try cutting out some of the characters to make it fit within the 8000 character limit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently created a new header file that I want to include in the
I recently created a advanced form with elements that use jquery's $().hide & $().show
I recently created a generic Matrix<T> class that acts as a wrapper around a
I recently created a function in javascript that takes in a file name and
I recently created a WCF service that works fine when tested from Visual Studio
I have a query that was recently required to be modified. Here's the original
I have recently just started working with Lucene (specifically, Lucene.Net) and have successfully created
I have a LINQ query that I want to order by the most recently
We were recently infected by the thumbs.db2 virus that has created shortcuts to all
I recently created my simple log4net database table for logging via the adonet appender..

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.