MySQL Forums
Forum List  »  Spanish

Re: AyUdA pOr FaVoR... CON CONSULTA CON VARIAS TABLAS
Posted by: William Chiquito
Date: June 07, 2007 09:28PM

Hola Eugenia,

Trata de la siguiente forma:
SELECT
	u.RFCUsu,
	u.nombreUsu AS nombre,
	COUNT(DISTINCT c.numRecibo) AS numcon,
	CONVERT(AVG(DISTINCT p.productividad), DECIMAL(10,3)) AS prod
FROM USUARIOS u
	LEFT JOIN CONSULTAS c ON (c.RFCUsu = u.RFCUsu AND c.fecha >= '2007-05-30' AND c.fecha <= '2007-05-31')
	LEFT JOIN PRODUCTIVIDAD p ON (p.RFCUsu = c.RFCUsu AND p.fecha = c.fecha)
GROUP BY u.RFCUsu, nombre;



Edited 1 time(s). Last edit at 06/07/2007 09:36PM by William Chiquito.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: AyUdA pOr FaVoR... CON CONSULTA CON VARIAS TABLAS
3314
June 07, 2007 09:28PM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.