Problem sorting and SUM value server side

Problem sorting and SUM value server side

bandit88bandit88 Posts: 2Questions: 0Answers: 0
edited May 2011 in General
Hello,

In a first time, i'd like to thank you for this great plugin which make prog easier and faster.
I use it with server side for loading table with 700 rows and it goes well. I join two tables on server side and it works really fine.
My problem today i can't solve is i do some php operations like this on server side and sorting doesn't work correctly.

[code]
$sQuery = "SELECT * FROM (SELECT table_commandes.ref_produit, table_commandes.prix_achat, table_commandes.quantite, table_commandes.pv_total_ht, table_commandes.ref_commande, SUM(table_commandes.prix_achat*table_commandes.quantite) AS cout_ht, SUM(table_commandes.pv_total_ht) AS full_pv_total_ht, COUNT(DISTINCT(table_commandes.ref_commande)) AS total_commandes, SUM(table_commandes.quantite) AS total_quantite,table_produits.produit, table_produits.taille, table_produits.couleur, table_produits.pv_ht, table_produits.pv_ttc, table_produits.marge_montant, table_produits.marge_pourcentage, table_produits.stock, table_produits.total_vues, table_produits.total_achats
FROM module_commandes table_commandes LEFT JOIN module_produits table_produits ON table_commandes.ref_produit = table_produits.reference WHERE table_commandes.annee=" .$_GET['year']. " AND ref_produit != '998' AND ref_produit != '999' GROUP BY ref_produit) sel
$sWhere
$sOrder
$sLimit
";
[/code]

I think it's because values use by Datatables for sorting are first value (before calculate and rendering).
I don' know how solve the problem. If someone has an idea ? Thanks for all
This discussion has been closed.