Poti face asa: SELECT nr1,nr2,nr3,nr4,nr5,nr6 FROM numbers where ( case when nr1 in (2, 3, 5, 7, 11, 13, 23, 29, 31, 37, 41, 43, 47) then 1 else 0 end + case when nr2 in (2, 3, 5, 7, 11, 13, 23, 29, 31, 37, 41, 43, 47) then 1 else 0 end + case when nr3 in (2, 3, 5, 7, 11, 13, 23, 29, 31, 37, 41, 43, 47) then 1 else 0 end + case when nr4 in (2, 3, 5, 7, 11, 13, 23, 29, 31, 37, 41, 43, 47) then 1 else 0 end + case when nr5 in (2, 3, 5, 7, 11, 13, 23, 29, 31, 37, 41, 43, 47) then 1 else 0 end + case when nr6 in (2, 3, 5, 7, 11, 13, 23, 29, 31, 37, 41, 43, 47) then 1 else 0 end ) in (1,2); Sa inteleg ca in loc de (2,3...,47) vrei o variabila care sa tina locu' vectorului, nu ? O singura intrebare: query-ul il faci in C++ sau rulezi direct in mysql ? //Ma culc, restu' maine seara.