I'm using server side processing with PHP 4.x so not JSON version.
I have SQL working for non-DataTables but can't figure out how to make my SQL work with DataTables and hoping your solution can work.
I have one table (po_spots) that can have multiple date ranges (launchdate) grouped with a primary key value (ponumber). I need to find the earliest date within that group and eventually assign as 'mindates.' Then join with table po_gen_info.
Like I said, my SQL statement is working but not with Datatable. Working SQL is:
[code]
SELECT po_gen_info.client,po_gen_info.promotitle,po_gen_info.projectlead,po_gen_info.station_kamx,po_gen_info.station_kkmj,po_gen_info.station_kjce,mindates.*
FROM ( SELECT ponumber
, MIN(launchdate) AS earliestdate
FROM po_spots WHERE `produced` != 'Yes'
GROUP
BY ponumber ) AS mindates
INNER
JOIN po_spots
ON po_spots.ponumber = mindates.ponumber
AND po_spots.launchdate = mindates.earliestdate
INNER
JOIN po_gen_info ON po_spots.ponumber = po_gen_info.ponumber
GROUP
BY ponumber
ORDER
BY mindates.earliestdate
[/code]
Can your approach work for me and if so can you please give me examples I can try?
Replies
I'm using server side processing with PHP 4.x so not JSON version.
I have SQL working for non-DataTables but can't figure out how to make my SQL work with DataTables and hoping your solution can work.
I have one table (po_spots) that can have multiple date ranges (launchdate) grouped with a primary key value (ponumber). I need to find the earliest date within that group and eventually assign as 'mindates.' Then join with table po_gen_info.
Like I said, my SQL statement is working but not with Datatable. Working SQL is:
[code]
SELECT po_gen_info.client,po_gen_info.promotitle,po_gen_info.projectlead,po_gen_info.station_kamx,po_gen_info.station_kkmj,po_gen_info.station_kjce,mindates.*
FROM ( SELECT ponumber
, MIN(launchdate) AS earliestdate
FROM po_spots WHERE `produced` != 'Yes'
GROUP
BY ponumber ) AS mindates
INNER
JOIN po_spots
ON po_spots.ponumber = mindates.ponumber
AND po_spots.launchdate = mindates.earliestdate
INNER
JOIN po_gen_info ON po_spots.ponumber = po_gen_info.ponumber
GROUP
BY ponumber
ORDER
BY mindates.earliestdate
[/code]
Can your approach work for me and if so can you please give me examples I can try?
Thanks,