English 中文(简体)
我如何能够让我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的我的吗?
原标题:How can I get this MySQL query to work on MySQL 4.1.15?

我的客户MySql 5有以下的问询,但我的客户MySql 4.1.15有这样的错误:

#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause

提升客户MySql版本并不是一种选择W。 难道有人会帮助我重新做这项工作,以了解MySql的旧版本?

SELECT 
   Sum( room_rev + room_rev_future ) as weekly_room_rev, 
   Sum( (`food_rev`) + (`beverage_rev`)) as weekly_catering_rev,
   (SELECT min_sales_persons 
   FROM bdp_hotel_min WHERE 
   bdp_hotel_min.hotel_num = bdp_scorecard.hotel_num 
   AND UNIX_TIMESTAMP(bdp_hotel_min.`min_override_week`) 
   < UNIX_TIMESTAMP("2011-12-02 23:59:59") 
   ORDER BY bdp_hotel_min.`min_override_week` DESC LIMIT 1 ) as override_persons,
   min_sales_persons 
FROM bdp_scorecard JOIN locations ON bdp_scorecard.hotel_num = locations.hotel_num 
WHERE bdp_scorecard.hotel_num =837 AND bdp_scorecard.hotel_num = 837 
AND UNIX_TIMESTAMP(bdp_scorecard.`created_date`) >= UNIX_TIMESTAMP("2011-11-26") 
AND UNIX_TIMESTAMP(bdp_scorecard.`created_date`) < UNIX_TIMESTAMP("2011-12-02 23:59:59") 
最佳回答

鉴于错误,似乎需要一个小组进行测试。

SELECT 
   Sum( room_rev + room_rev_future ) as weekly_room_rev, 
   Sum( (`food_rev`) + (`beverage_rev`)) as weekly_catering_rev,
   (SELECT min_sales_persons 
   FROM bdp_hotel_min WHERE 
   bdp_hotel_min.hotel_num = bdp_scorecard.hotel_num 
   AND UNIX_TIMESTAMP(bdp_hotel_min.`min_override_week`) 
   < UNIX_TIMESTAMP("2011-12-02 23:59:59") 
   ORDER BY bdp_hotel_min.`min_override_week` DESC LIMIT 1 ) as override_persons,
   min_sales_persons 
FROM bdp_scorecard JOIN locations ON bdp_scorecard.hotel_num = locations.hotel_num 
WHERE bdp_scorecard.hotel_num =837 AND bdp_scorecard.hotel_num = 837 
AND UNIX_TIMESTAMP(bdp_scorecard.`created_date`) >= UNIX_TIMESTAMP("2011-11-26") 
AND UNIX_TIMESTAMP(bdp_scorecard.`created_date`) < UNIX_TIMESTAMP("2011-12-02 23:59:59")
GROUP BY override_persons, min_sales_persons
问题回答

暂无回答




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签