PORFAVOR NESECITO SABER COMO OBTENGO DE LA BASE DATOS EL
EMPLEADO ,TITULO DEL EMPLEADO Y LA CANTIDAD DE PEDIDOS DE AQUEL QUE EMITIO MENOS DURANTE EL ULTIMO AÑO REGISTRADO
. EL ULTIMO MES DEBERA SER OBTENIDO,NO UTILICE DIRECTAMENTE EL NUMERO DEL MES
SELECT e.FIRSTNAME+' '+ "LASTNAME" AS EMPLEADO,e.title,count(od.quantity)as cantidad,o.requireddate from employees as e
inner join orders as o
on e.employeeid=o.employeeid
inner join [order details] as od
on o.orderid=od.orderid
where year(requireddate)=1998 and month(requireddate)=6
GROUP BY e.firstname,lastname,e.title,od.quantity,o.requireddate
------TRATE USAR SUBCONSULTA
SELECT E.FIRSTNAME+','+"LASTNAME"as empleado,e.TITLE,count(OD.QUANTITY) as cantidad from employees as e,orders as o,[order details]as od
where e.employeeid=o.employeeid and o.orderid=od.orderid and orderdate=(select max(orderdate)from orders )
GROUP BY e.title,e.firstname,e.lastname,od.quantity