I have a website which uses the custom 404 error handling in PHP/Apache to display specific pages.
e.g. http://metachat.org/recent
I've a feeling this is a bad way of doing this, but it's code I inherited...
Although the page displays correctly on most browsers, I'm getting a situation where AVG Anti-Virus is hijacking the page and re...
Hi,
I need your help,
I have developed a comparative report like this:
01:00 02:00
Desv 10 23
15/01/2009 20 22
16/01/2009 30 45
I have a dataset with values from two different dates every 15 minutes.
I have a matrix which is grouped by row Date and grouped by column ...
I have to work with an analysis tool that measures the Web Service calls to a server per hour. These measurments are inserted in a database. The following is a snippet of such a measurement:
mysql> SELECT * FROM sample s LIMIT 4;
+---------+------+-------+
| service | hour | calls |
+---------+------+-------+
| WS04 | 04 ...
I have a table of locations with latitude, longitude and the U.S. state fields. I would like to select the average latitude and longitude for each state.
I am trying the following code but I get a syntax error on distinct.
select avg(lat), avg(lon), distinct(state) from tRealtyTrac order by state group by state
...
SELECT *, GROUP_CONCAT(rating) AS rating_total, SUM(rating_total) AS rating_sum, AVG(rating_sum) AS rating_avg FROM ratings GROUP BY pid
For some reason the sum and average don't execute....how do you make this statement work?
...
I have the following query in MSSQL:
select
TRANSACTION_TYPE_ID
,COUNT(TRANSACTION_TYPE_ID)AS NUMBER_OF_TRANSACTIONS
,CAST(SUM(AMOUNT)AS DECIMAL (30,2)) AS TOTAL
FROM
[ONLINE_TRANSACTION]
WHERE CONVERT(CHAR(8), CREATED_ON, 114) >='17:30' AND AMOUNT IS NOT NULL AND
TRANSACTION_TYPE_ID !='CHEQUE-STOP-TRANS-TYPE'
GROUP BY TRAN...
SELECT AVG(variable) AS Expr1, SUM(variable) AS Expr2
FROM ......
result for AVG is 2, but it is not true, it must be 2.95. What is the problem, any idea?
...
Does anyone know why a SQL SELECT query returns no rows when SELECTing from an empty table, but when trying to SELECT the AVG from a column in an empty table it returns < null >? The difference in behavior just seems odd to me. I’m using a sqlite database if that makes any difference.
Here are the two queries:
Normal select: SELECT ...
Although I can group and order by on an aliased sub query, I can't use the alias in a where clause. Do I need to use a join instead?
Works:
SELECT entries.*,
(SELECT avg(value)
FROM `ratings`
WHERE ratings.entry_id = entries.id) as avg_rating
FROM `entries`
ORDER BY avg_rating DESC
Fails ("unknown column 'avg_rating' i...
Hi folks,
I have three variables :-
@ScoreA DECIMAL(10,7)
@ScoreB DECIMAL(10,7)
@ScoreC DECIMAL(10,7)
@FinalScore DECIMAL(10, 7)
I wish to get the average of the three scores. BUT 1, 2 or all 3 values might be zero.
Eg. scenarios:
A = 1.4, B=3.5, C=5.0; FinalScore = 3.3
A = 0.0, B=0.0, C=0.0; FinalScore = 0.0
A = 1.1, B=0.0, C=0.0...
I'm working with a table of float values, but I enter the column by parameter
SELECT AVG(@var) AS Aver
FROM ListVal
When I enter the column name (the parameter) I recieve an error: That the datatype nvarchar is not valid for the avg operator. But all the columns are float.
Help!!! please
...
Can I combine these 2 SQL statements? Currently running 2 queries. Trying to tighten up a bit.
First one:
SELECT * FROM (`cars`)
JOIN `brands` ON `brands`.`br_id` = `cars`.`brand_id`
WHERE `cars`.`id` = '185707'
Second one:
SELECT ROUND(AVG(rating)) as avg_rating
FROM car_ratings WHERE car_id = 185707
...
I have a query that takes avg data (prices) from 7 days of the week for a long interval. IE avg prices for monday, tues, etc. It works fine, but I'm unsure how I can in the same query sum the avgs that this query finds? Summing Day1..Day5
As it stands this query sums the entire from of all the prices... IE huge number.. not from the ...
I have a table storing transactional data for users. To find a users rating you take the average score of the last 10 entries for that user. Is there a way to get that with SQL?
I need to be able to work it out for a single user given their ID. And to get a list of all users ordered by their score.
Currently I'm working it out outside ...
Why does
select avg(cast(5 as numeric(15,2)))
returns "Arithmetic overflow error converting numeric to data type numeric."?
Documentation states the following about the avg function:
input: decimal category (p, s)
output: decimal(38, s) divided by
decimal(10, 0)
I don't really see how it would overflow.
...
This query has baffled me... I've searched the web work over a day now and I have tried numerous things.
I want to get the avg number of orders for every day of the week from my db. I can pull the total # with COUNT just fine. But I just can't figure out how to get the AVG of COUNT on a GROUP BY. I've tried subqueries... functions... ev...
Group,
This is hard to explain, but I am building a matrix report in SSRS. My row includes a product code, my columns are months (previous 13) and my values are units sold for the corresponding product/month. I found some custome code that would let me change my subtotal to Avg However, for some products there might not be any units s...
How can you write the following in MYSQL?
SELECT AVG(col1) FROM table WHERE DISTINCT col2
more info:
table
col1 | col2
-----------
2 | 555.555.555.555
5 | 555.555.555.555
4 | 444.444.444.444
returns '3'
Basically I'm trying to select average value of col1 where ip addresses in col2 are distinct.
...
Hi, I'm trying to get the AVERAGE from the results of two separate sql queries built in MS Access. The first sql query pulls the largest record:
SELECT DISTINCTROW Sheet1.Tx_Date, Sheet1.LName, Sheet1.Patient_Name, Sheet1.MRN,
Max(Sheet1.) AS [Max Of FEV1_ACT],
Max(Sheet1.FEF_25_75_ACT) AS [Max Of FEF_25_75_ACT]
FROM Sheet1
GROUP ...
I have a table called Sessions with two datetime columns: start and end.
For each day (YYYY-MM-DD) there can be many different start and end times (HH:ii:ss). I need to find a daily average of all the differences between these start and end times.
An example of a few rows would be:
start: 2010-04-10 12:30:00 end: 2010-04-10 12:30:5...