adam nelson queried: > iPersonType is a list in the form of 1,2,4,8,16,32,64 > > so, let's suppose that szPersonType for 8 is lawyer and szPerson type > for 2 is redhead > > a value of iPersonType of 10 would mean redhead lawyer. > > I'd like a query that looks for lawyers (ie. iPerson type is any number > from 8 to 15 or 16+8=32 or 16+8+4=28 or 16+8+1=29 or 16+8+4+2=30 or > 32+8=40 or 32+8+4=44 ,etc. up to the max(iPersonType))
If you don't like bit functions (manual section 6.3.5.1) you can always divide by the iPersonType and take modulus 2. A result of 1 says it's a hit, 0 says it's a miss. Incidentally, have you considered using a SET type here (manual section 6.2.3.4)? Joel Rees Alps Giken Kansai Systems Develoment Suita, Osaka --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php