Shouldn't there be? One for the main query and one for the derived table? (thanks for all the help so far btw)arborint wrote:Now you have two FROM clauses...
Add Column Of Days From Date
Moderator: General Moderators
Re: Add Column Of Days From Date
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Add Column Of Days From Date
I don't think you can use 'count' as a column name without quoting because it is a reserved word.
(#10850)
Re: Add Column Of Days From Date
Tried it a few different ways;arborint wrote:I don't think you can use 'count' as a column name without quoting because it is a reserved word.
Code: Select all
SELECT DAYNAME( `date` ) AS day, AVG(theCount) FROM (SELECT COUNT( * ) as theCount , DAYNAME( `date` ) AS day FROM phonelog2 WHERE DAYNAME( `date` )="Monday" GROUP BY `date`) phonelog2Code: Select all
SELECT DAYNAME( `date` ) AS day, AVG('Count') FROM (SELECT COUNT( * ) as 'Count' , DAYNAME( `date` ) AS day FROM phonelog2 WHERE DAYNAME( `date` )="Monday" GROUP BY `date`) phonelog2Code: Select all
SELECT DAYNAME( `date` ) AS day, AVG('theCount') FROM (SELECT COUNT( * ) as 'theCount' , DAYNAME( `date` ) AS day FROM phonelog2 WHERE DAYNAME( `date` )="Monday" GROUP BY `date`) phonelog2Re: Add Column Of Days From Date
Solved
For anyone that needs reference in the future, subqueries/derived tables do not work in MySQL versions older than 4.1.
For anyone that needs reference in the future, subqueries/derived tables do not work in MySQL versions older than 4.1.