Code:
SELECT ventas. * , ventas.importe_acordado - SUM( pagos.importe ) AS valor_dinamico
FROM ventas
LEFT OUTER JOIN pagos ON pagos.venta = ventas.id
WHERE STR_TO_DATE( pagos.fecha, '%d/%m/%Y' ) > NOW( ) - INTERVAL 1 WEEK
GROUP BY ventas.id
HAVING valor_dinamico >0
LIMIT 0 , 30
MySQL ha dicho:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WEEK GROUP BY ventas.id HAVING valor_dinamico > 0
LIMIT 0, 30' at line 1
// NOW() - INTERVAL 1 WEEK\r\nGROUP BY ventas.id\r\nHAVING valor_dinamico >0 '); } if (window.parent.frame_content) { // reset content frame name, as querywindow needs to set a unique name // before submitting form data, and navigation frame needs the original name if (window.parent.frame_content.name != 'frame_content') { window.parent.frame_content.name = 'frame_content'; } if (window.parent.frame_content.id != 'frame_content') { window.parent.frame_content.id = 'frame_content'; } //window.parent.frame_content.setAttribute('name', 'frame_content'); //window.parent.frame_content.setAttribute('id', 'frame_content'); } //]]>
I think Im having some trouble.. also, is there a way to SUM( pagos.importe ) only where pagos.type = 3 ? is there a way to have a condition in the sum?
I dont want to trouble you all night long, so Im currently reading on google about this, anyway, any help or recommended reading is appreciated.
Bookmarks