Co dziwne. W manualu jest tak:
Cytat
#
DATEDIFF(expr,expr2)
DATEDIFF() returns the number of days between the start date expr and the end date expr2. expr and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation.
mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
-> 1
mysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');
-> -31
// chbya że kwestia przecinka ? w '1997-11-30 23:59:59'
Z tego roumuje ze mój zapis
<?php
SUM
((DATEDIFF
(IFNULL
(data_rozw
,$data),data_od
)) + count(pesel
)?>
Jest ok.
Sprawdziłem go przez debuga, w designerze2005 i też nie napisałem mi że cokolwiek jest nie wporzo.
Po próbie wykonia owszem wywaliło mi błędem ale na.
Kod
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 'from daty group by pesel order by count(pesel)' at line
Czyli na fragment
<?php
$patrz_id = mysql_query("select count(pesel),pesel,SUM((DATEDIFF(IFNULL(data_rozw,$data),data_od)) + count(pesel) [COLOR=red]from daty group by pesel order by count(pesel)")[/COLOR
] ?>
WHY? (jak to stringi to się nie obrażaj

- ale ja nie widze i debug też nie widzi)
Jak zrobiłem bez przecinka czyli
<?php
("select count(pesel),pesel,SUM((DATEDIFF(IFNULL(data_rozw $data),data_od))
?>
to wywalił
Kod
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 '2006-02-28),data_od)) + count(pesel) from daty group by pesel order by count(pes' at line 1