Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

[Решено] Запрос Mysql возвращает не корректные данные


Recommended Posts

Доброго дня форумчане,  есть запрос:

SELECT cr.customer_id, CONCAT(c.firstname, ' ', c.lastname) AS customer, c.email, cgd.name AS customer_group, c.date_added, SUM(cr.points) AS points
 FROM mo_customer_reward cr 
 LEFT JOIN `mo_customer` c ON (cr.customer_id = c.customer_id) 
 LEFT JOIN mo_customer_group_description cgd ON (c.customer_group_id = cgd.customer_group_id) 
 WHERE points < '10000' 
 AND points > '1000' 
 GROUP BY cr.customer_id;

 

Запрос возвращает таблицу:

ustomer_id		customer		email		customer_group		date_added			points
  1			ФИО			email@adm.ru 	   Покупатели   2014-05-08 14:49:41 		 13500
  3			ФИО			email@adm.ru 	   Покупатели   2016-03-28 19:47:40 		 2751
  6			ФИО			email@adm.ru 	   Покупатели   2016-03-31 13:27:15 		 9998

 

Вопрос, почему в Ответ попал пользователь с 13500 баллами?

Edited by mesateri
Link to post
Share on other sites

вместо тысячи слов, 1 слово решило все)). chukcha, благодарю за помощь

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.