'LIKE' for numbers

2005-12-18 Thread Andy Pieters
Hi all Is there any operator for mysql that behaves like LIKE but can act on numbers. Let's say I wanted to select all rows where column x has a value of ~ y How should I do this? With kind regards Andy -- Now listening to Trancelation - Intensensation on amaroK Geek code:

Re: 'LIKE' for numbers

2005-12-18 Thread Yves Goergen
On 18.12.2005 11:06 (+0100), Andy Pieters wrote: Is there any operator for mysql that behaves like LIKE but can act on numbers. Let's say I wanted to select all rows where column x has a value of ~ y How should I do this? You can use BETWEEN x AND y or maybe also IN (x, x+1, ...,

Re: 'LIKE' for numbers

2005-12-18 Thread Jochem van Dieten
On 12/18/05, Andy Pieters [EMAIL PROTECTED] wrote: Is there any operator for mysql that behaves like LIKE but can act on numbers. No. But with a bit of creativity you can use arithmetic to come to a predictae that does the same: SELECT * FROM table WHERE floor(log10(floor(x / y)))

Re: 'LIKE' for numbers

2005-12-18 Thread Gleb Paharenko
Hello. Let's say I wanted to select all rows where column x has a value of ~y Please, could you explain, what does it mean x ~ y. LIKE works for integer, at least in traditional way: mysql create table tint(a int); Query OK, 0 rows affected (0.04 sec) mysql insert into tint set

regexp with - '-' or - like phone numbers e.g: d-dd-d dd-dd-d ddd-dd-d dddd-dd-d

2003-11-08 Thread karthikeyan
I have one query: how to use regular expression to search all digits of the pattern in MYSQL X-XX-X XX-XX-X XXX-XX-X -XX-X X-XX-X I tried mysql select * from database where field regexp (\d{2,5}-\d{2}-d{1}d{1}); others: *-*-* ??-??-? ???-??-? (\d{2,5})?- etc, seems not working

Re: regexp with - '-' or - like phone numbers e.g: d-dd-d dd-dd-d ddd-dd-d dddd-dd-d

2003-11-08 Thread Jan Pieter Kunst
because '-' is understood as from - to e.g a-z, 0-9, etc., Escape the '-' with a backslash: '\-' JP -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: regexp with - '-' or - like phone numbers e.g: d-dd-d dd-dd-d ddd-dd-d dddd-dd-d

2003-11-08 Thread karthikeyan
atleast: d-dd-d 0-00-0 9-99-0 select count(*) from processes where `in` regexp [0-9]{1}-[0-9]{2}-[0-9]{1 }; for: 00-00-0 99-99-0 select count(*) from processes where `in` regexp [[:space:]][0-9]{2}-[0-9] {2}-[0-9]{1}; for 00-00-0, 99-99-0, select count(*) from processes where