tu specialmente.....Originariamente inviato da nicola75ss
Anche io ignoravo l'esistenza di questa funzione. Ti stavo suggerendo id%2=0 che avrebbe risolto ugualmente ma gm mi ha anticipato.
Abbiamo imparato una cosa nuova.
Ci servono ancora ripetizioni dal Dottor mac e dal prof. gm.![]()
![]()
id % 2 = 0 e assolutamente identico a
MOD(id, 2 ) = 0 cosi' come lo e'
id MOD 2 = 0
occhio alle versioni di mysql....
MOD(N,M), N % M, N MOD M
Modulo operation. Returns the remainder of N divided by M.
mysql> SELECT MOD(234, 10);
-> 4
mysql> SELECT 253 % 7;
-> 1
mysql> SELECT MOD(29,9);
-> 2
mysql> SELECT 29 MOD 9;
-> 2
This function is safe to use with BIGINT values. The N MOD M syntax works only as of MySQL 4.1.0.
As of MySQL 4.1.7, MOD() works on values that have a fractional part and returns the exact remainder after division:
mysql> SELECT MOD(34.5,3);
-> 1.5
Before MySQL 4.1.7, MOD() rounds arguments with a fractional value to integers and returns an integer result:
mysql> SELECT MOD(34.5,3);
-> 2
![]()

Rispondi quotando