On Fri, 18 May 2001, Kip Turk wrote:

>
> Is it possible to make this type of logical command in MySQL?
>
> if ((x == y) or (x == z))     { response1 }
> else  { response2 }
>

I'll go ahead and follow up my own post, as I found a solution, using
regexp.  Here's a test case I ran if anyone else is interested:

select distinct(if(substring(username,1,8) regexp 'ange(wcc|pin)-',
lcase(trim(leading concat(substring_index(username,'-',1), '-') from
username)), lcase(username))) as username from radacct where acctstarttime
between '2001-05-17' and '2001-05-18' order by username;

Basically, I wanted to see if the username started with angewcc- or
angepin- and if so, remove that portion of the string.  It worked quite
well, returning 3000 rows in less than a second.

cheers,
-- 
===============================================
Kip Turk                    phone: 915.234.5678
Systems Administrator           or 800.695.9016
Killer of Spam/Writer of Code/Penguin Proponent
West Central Net              fax: 915.656.0071
===============================================



---------------------------------------------------------------------
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

Reply via email to