Ok, so I’ve got two tables: jobs, and job runs. I’m using Postgres. I want to look at 2 periods. 7 days ago until now, and 14 days ago to 7 days ago. For each job, I want a total of the number of runs, and a percentage of successful and unsuccessful runs for each period. I’ve cooked up this
Tag: statistics
Linear extrapolate values down to 0 from variable starting points
I want to build a query which allows me to flexible linear extrapolate a number down to Age 0 starting from the last known value. The table (see below) has two columns, column Age and Volume. My last known volume is 321.60 at age 11, how can I linear extrapolate the 321.60 down to age 0 in annual steps? Also,
Sql: Find sum of column from second table using date from first table
I’ve been struggling to build a query that calculate the sum of column called ‘TIDAL_VOLUME’ with respect to date value that’s coming from another table. Please see the content of the Table_1: Please see the content of the Table_2: Note: TIDAL_VOLUME might have NULL as well. Now, the start time for O2_Device value ‘Endotracheal tube’ is ‘2013-08-06 08:10:05’ for same
SQL: How to determine the most frequent data length in the DB column?
Need to analyze values’ length in DB column and get the % of the Number of the values with the same length. Desire result: Same length values in COL1 = 70% with LENGTH = 10 chars It’s …
Product() aggregate function
While explaining some concepts over CTE, was asked with a cute question.. can we find the multiplication of rows , while we always concentrate on the SUM() from a fresher. That gave me a thought! Is it ever possible with just an SQL. I was also considering the maximum number precision we can even support, since the product may be
SQL Top 10 Sales Every Month
Greeting all. I have a SQL 2008 express database, lets name is tbl_Merchant, similar as following: Merchant | Sales | Month Comp.1 100 1 Comp.2 230 1 Comp.3 120 1 Comp.1 …
Detecting abuse for post rating system
I am using a wordpress plugin called “GD Star Rating” to allow my users to vote on stories that I post to one of my websites. http://everydayfiction.com/ Recently we have been having a lot of abuse of the system. Stories that have obviously been voted up artificially. “GD Star Rating” creates some detailed logs when a user votes on a