Hi Anthony, Please reply to the list also (and not just me) so others can follow the discussion. :-)
Well, if the commas are sometimes there, sometimes not (*with multiple numbers*), that's a problem. However, if you just mean that the commas aren't there when it's just one number, then the query I gave will work fine for that because it adds a comma to the beginning and end of the column (with CONCAT()) before doing the LIKE comparison. Matt ----- Original Message ----- From: "award" Sent: Saturday, March 13, 2004 5:10 PM Subject: RE: query question using REGEXP > Hi thanks for the help > > But the problem in the column it can take various form > Just as > 1 > 1,2 > 12 > 1,22,4 > > sometimes I have the comma and sometimes I do not have them. > > So if do WHERE column LIKE %2% > > would it work?? > thank you > > anthony > > -----Original Message----- > From: Matt W [mailto:[EMAIL PROTECTED] > Sent: 13 March 2004 22:47 > To: award; [EMAIL PROTECTED] > Subject: Re: query question using REGEXP > > Hi Anthony, > > You don't need REGEXP for this; LIKE will do. Try something like this: > > ... WHERE CONCAT(',', Column, ',') LIKE '%,2,%' > > to search for rows that contain 2. > > Hope that helps. > > > Matt > > ----- Original Message ----- > From: "award" > Sent: Saturday, March 13, 2004 2:16 PM > Subject: query question using REGEXP > > > > Hi, > > > > I'm storing in a database numbers separated by comma if more than one > > number i.e > > Record # Column > > 1 12 > > 2 1,2,5,6 > > 3 1,12,24,45 > > 4 2,6 > > > > Now if I want to search for records that has number 1 it will find > > records 1,2,3 > > but what I want to return only record 2,3 > > an example is that if I'm looking for a record that has a number 2 > > it will print record 1,2,3,4 but what I want is only record 2,4 > > > > Any help is appreciated, > > anthony -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]