Jump to content

Combining queries?


_OwNeD.YoU_

Recommended Posts

probably a union

$sql="
select yourfields from yourtable where `MONTH` >='".$data_lastfs."'
UNION 
select yourfields from yourtables where MONTH < '".$data_lastfsend."'"; 

o r an or would probably work in this case

$sql="
select yourfields from yourtable where `MONTH` >='".$data_lastfs."' or `MONTH` < '".$lastfsend."'"; 

 

Link to comment
https://forums.phpfreaks.com/topic/197673-combining-queries/#findComment-1037396
Share on other sites

SELECT SUM(data.INVOICED) AS lfinvoice FROM `data` WHERE `MONTH` >= '2010-12-01' AND '2010-01-01' >=  `MONTH`

 

SELECT SUM(data.INVOICED) AS linvoice FROM `data` WHERE `MONTH` >= '2009-12-01' AND '2009-01-01' >=  `MONTH`

 

 

like combing these to get the difference of the two or have them in difference columns rather than 1 combined which was what was happening with "Union"

Link to comment
https://forums.phpfreaks.com/topic/197673-combining-queries/#findComment-1037525
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.