Matching problem

2006-05-09 Thread Barry

Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: 87682next39857

I created that with concat.
Is there a way to match one specific number out of that field?
like WHERE SUPERFUNCTION(concated_field) = 87682

Is something like that possible in any way?
Or does something like that function exists?
Well in PHP you a function called in_array() which would work kind of 
similiar what i want to do.


Any help is very appriciated ^_^

Many thanks for any replies

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Matching problem

2006-05-09 Thread Barry

Barry schrieb:

Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: 87682next39857

I created that with concat.
Is there a way to match one specific number out of that field?
like WHERE SUPERFUNCTION(concated_field) = 87682

Is something like that possible in any way?
Or does something like that function exists?
Well in PHP you a function called in_array() which would work kind of 
similiar what i want to do.


Any help is very appriciated ^_^

Many thanks for any replies

Barry


Ok found a solution:

WHERE concated_field REGEXP '(^|)87682(|$)'

Greets
Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Matching problem

2006-05-09 Thread Wolfram Kraus

Barry wrote:

Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: 87682next39857

I created that with concat.
Is there a way to match one specific number out of that field?
like WHERE SUPERFUNCTION(concated_field) = 87682


WHERE concated_field LIKE '%87682%'

See: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html

BTW:
1. The performance of LIKE is not that good :-S
2. This doesn't sound like a good DB-Design, why don't you use two 
seperated fields for both numbers, or a m:n table if there are more 
possible entries?



Is something like that possible in any way?
Or does something like that function exists?
Well in PHP you a function called in_array() which would work kind of 
similiar what i want to do.


Any help is very appriciated ^_^

Many thanks for any replies

Barry



HTH,
Wolfram


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Matching problem

2006-05-09 Thread 彭一凡
try this:
WHERE concated_field LIKE '87682%'
or
WHERE concated_field LIKE '87682next_'

it is based on SQL-99, not using PHP
 
- Original Message - 
From: Barry [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Tuesday, May 09, 2006 8:49 PM
Subject: Matching problem


 Hello everyone!
 
 I have a slight problem matching rows.
 
 My problem is the Value in a textfield is: 87682next39857
 
 I created that with concat.
 Is there a way to match one specific number out of that field?
 like WHERE SUPERFUNCTION(concated_field) = 87682
 
 Is something like that possible in any way?
 Or does something like that function exists?
 Well in PHP you a function called in_array() which would work kind of 
 similiar what i want to do.


Re: Matching problem

2006-05-09 Thread Barry

Wolfram Kraus schrieb:

Barry wrote:

Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: 87682next39857

I created that with concat.
Is there a way to match one specific number out of that field?
like WHERE SUPERFUNCTION(concated_field) = 87682


WHERE concated_field LIKE '%87682%'


It would also give me Fields that have 987682 or 876825.
That's not what i looked for but thanks anyway ;)

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Matching problem

2006-05-09 Thread Barry
彭一凡 schrieb:
 try this:
 WHERE concated_field LIKE '87682%'
 or
 WHERE concated_field LIKE '87682next_'
 
would give me 876825 what i am not looking for.
And i were also looking for next87682.

So this doesn't work.

But thanks anyway :)

-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Matching problem

2006-05-09 Thread Marcus Bointon


On 9 May 2006, at 14:27, Wolfram Kraus wrote:


WHERE concated_field LIKE '%87682%'


No, because that would also match numbers that contain that sequence  
like '187682next32876825'.


2. This doesn't sound like a good DB-Design, why don't you use two  
seperated fields for both numbers, or a m:n table if there are more  
possible entries?


Definitely.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Matching problem

2006-05-09 Thread Barry

Marcus Bointon schrieb:


On 9 May 2006, at 14:27, Wolfram Kraus wrote:


WHERE concated_field LIKE '%87682%'


No, because that would also match numbers that contain that sequence 
like '187682next32876825'.


2. This doesn't sound like a good DB-Design, why don't you use two 
seperated fields for both numbers, or a m:n table if there are more 
possible entries?


Definitely.


Well not my one though :P

But have to work with it ^^

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Matching problem

2006-05-09 Thread Wolfram Kraus

Marcus Bointon wrote:


On 9 May 2006, at 14:27, Wolfram Kraus wrote:


WHERE concated_field LIKE '%87682%'



No, because that would also match numbers that contain that sequence  
like '187682next32876825'.


WHERE concated_field LIKE '87682%' OR concated_field LIKE '%87682'

Still poor performance ;-)

[...]


Marcus



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: one word fulltext matching problem...

2002-11-11 Thread Bjorn Palsson
At 15:36 2002-11-10 -0800, you wrote:
From: A. J. Maclean [EMAIL PROTECTED]

I have a query like this:

SELECT * FROM bc_posts WHERE MATCH (post_city, post_location, post_details,
post_message) AGAINST ('webster');

I get the results as follows:

webster hall
webster
webster hall club

How come the exact match (i.e. webster) does not get a higher relevance?

Without ORDER BY clause, results of a SELECT are in arbitrary order. That's 
just the way SQL works --  there is no relevance ranking among the results.

Yes and no. There is relevance ranking but you have to tell MySQL to sort it.
Just copy your MATCH to the ORDER BY and use DESC to get the most relevant
results first. 

Example from the 4.0.0 manual a little enhanced:

mysql SELECT id, body, MATCH (title,body) AGAINST ( 
- 'Security implications of running MySQL as root') AS score 
- FROM articles WHERE MATCH (title,body) AGAINST 
- ('Security implications of running MySQL as root')
- ORDER BY score DESC; 
++---+-+
 | id | body | score | 
++---+-+
 | 4 | 1. Never run mysqld as root. 2. Normalize ... | 1.5055546709332 |
 | 6 | When configured properly, MySQL could be ... | 1.31140957288 |
 ++---+-+

More to read: 6.9 MySQL Full-text Search

Regards

-
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




one word fulltext matching problem...

2002-11-10 Thread A. J. Maclean

I have a query like this:

SELECT * FROM bc_posts WHERE MATCH (post_city, post_location, post_details,
post_message) AGAINST ('webster');

I get the results as follows:

webster hall
webster
webster hall club

How come the exact match (i.e. webster) does not get a higher relevance?
I remember seeing some kind of workaround for this problem, but I can not
for the life of me find it anymore!!

TIA,

AJ


-
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




Re: one word fulltext matching problem...

2002-11-10 Thread Octavian Rasnita
Hi,

If 'webster' can be found in more than a half of the records from the
database, it is considered a stop word and it is ignored.

The solution is to force searching for that word by placing a '+' sign
before it like '+webster'

I guess this should be the problem, but if it is not the case, ... sorry.
I've started learning MySQL only for 3 days.

Cheers.
Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: A. J. Maclean [EMAIL PROTECTED]
To: MySQL List [EMAIL PROTECTED]
Sent: Sunday, November 10, 2002 1:16 PM
Subject: one word fulltext matching problem...



I have a query like this:

SELECT * FROM bc_posts WHERE MATCH (post_city, post_location, post_details,
post_message) AGAINST ('webster');

I get the results as follows:

webster hall
webster
webster hall club

How come the exact match (i.e. webster) does not get a higher relevance?
I remember seeing some kind of workaround for this problem, but I can not
for the life of me find it anymore!!

TIA,

AJ


-
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




-
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




Re: one word fulltext matching problem...

2002-11-10 Thread Jan Steinman
From: A. J. Maclean [EMAIL PROTECTED]

I have a query like this:

SELECT * FROM bc_posts WHERE MATCH (post_city, post_location, post_details,
post_message) AGAINST ('webster');

I get the results as follows:

webster hall
webster
webster hall club

How come the exact match (i.e. webster) does not get a higher relevance?

Without ORDER BY clause, results of a SELECT are in arbitrary order. That's just the 
way SQL works --  there is no relevance ranking among the results.

-- 
 SQL SQL SQL SQL SQL SQL SQL SQL  
: Jan Steinman -- nature Transography(TM): http://www.Bytesmiths.com
: Bytesmiths -- artists' services: http://www.Bytesmiths.com/Services
: Buy My Step Van! http://www.Bytesmiths.com/van

-
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




RE: one word fulltext matching problem...

2002-11-10 Thread A. J. Maclean

From: Jan Steinman [mailto:Jan;Bytesmiths.com]
Sent: Sunday, November 10, 2002 6:37 PM
To: [EMAIL PROTECTED]
Subject: Re: one word fulltext matching problem...

Without ORDER BY clause, results of a SELECT are in arbitrary order. That's
just the way SQL works --  there is no relevance ranking among the
results.

--

Direct from the Manual (section 6.8):

When MATCH() is used in a WHERE clause (see example above) the rows
returned are automatically sorted with highest relevance first.

I should add that the query word webster is not in more than half of the
dataset (only in 3 rows out of 18, to be exact).

Any other suggestions?


-
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




Pattern Matching Problem

2002-01-29 Thread Douglas Brantz

Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entries containing M, W or F.  Is there a way to do this?  

mysql select schdays from courses where schdays LIKE %MWF%;
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql select schdays from courses where schdays LIKE %M%;
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
%schdays%


Here is my code from the program:
my $sth2 = $dbh-prepare(select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \\%$cschdays\%\ AND
done=\Yes\etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
[EMAIL PROTECTED]

--
Douglas R. Brantz
Computer Consultant
Fine  Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)




-
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




Re: Pattern Matching Problem

2002-01-29 Thread Christopher Thompson

At 03:15 PM 1/29/2002 -0500, Douglas Brantz wrote:
Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entries containing M, W or F.  Is there a way to do this?

mysql select schdays from courses where schdays LIKE %MWF%;
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql select schdays from courses where schdays LIKE %M%;
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
%schdays%


Here is my code from the program:
my $sth2 = $dbh-prepare(select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \\%$cschdays\%\ AND
done=\Yes\etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

I'd do this by doing a pattern match on %M% and then joining it with a 
pattern match on %W% and then joining it with a pattern match on %F%.  I 
forget which type of join you want, it's the one that is logical-OR.

You may wish this was easier (and there may be an easier way of doing it), 
but the fundamental problem is that you think pattern matching in SQL works 
differently to how it actually works.



-
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




Re: Pattern Matching Problem

2002-01-29 Thread Paul DuBois

At 15:15 -0500 1/29/02, Douglas Brantz wrote:
Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entries containing M, W or F.  Is there a way to do this?

Yes, but you can't do it with LIKE except in an ugly way:

WHERE schdays LIKE %M% OR schdays LIKE %W% OR schdays LIKE %F%

You're better off using regular expressions and the REGEXP operator.
Regular expressions allow character classes (match any character listed
inside square brackets):

WHERE schdays REGEXP [MWF]

You could also use alternation, although that's more useful when you're
trying to match any of several multiple-character strings:

WHERE schdays REGEXP (M|W|F)


mysql select schdays from courses where schdays LIKE %MWF%;
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql select schdays from courses where schdays LIKE %M%;
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
%schdays%


Here is my code from the program:
my $sth2 = $dbh-prepare(select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \\%$cschdays\%\ AND
done=\Yes\etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
[EMAIL PROTECTED]

--
Douglas R. Brantz
Computer Consultant
Fine  Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)




-
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


-
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




RE: Pattern Matching Problem

2002-01-29 Thread Matthew Walker

SELECT schdays FROM courses WHERE (schdays LIKE M) OR (schdays LIKE
W) OR (schdays LIKE F)

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-Original Message-
From: Douglas Brantz [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 1:15 PM
To: [EMAIL PROTECTED]
Subject: Pattern Matching Problem

Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entries containing M, W or F.  Is there a way to do this?  

mysql select schdays from courses where schdays LIKE %MWF%;
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql select schdays from courses where schdays LIKE %M%;
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
%schdays%


Here is my code from the program:
my $sth2 = $dbh-prepare(select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \\%$cschdays\%\ AND
done=\Yes\etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
[EMAIL PROTECTED]

--
Douglas R. Brantz
Computer Consultant
Fine  Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)




-
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



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

-
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




RE: Pattern Matching Problem Solved

2002-01-29 Thread Douglas Brantz

Thanks to everyone for being so helpful with this solution.

Douglas


--
Douglas R. Brantz
Computer Consultant
Fine  Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)


-Original Message-
From: Matthew Walker [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 3:46 PM
To: Douglas Brantz; [EMAIL PROTECTED]
Subject: RE: Pattern Matching Problem

SELECT schdays FROM courses WHERE (schdays LIKE M) OR (schdays LIKE
W) OR (schdays LIKE F)

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-Original Message-
From: Douglas Brantz [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 1:15 PM
To: [EMAIL PROTECTED]
Subject: Pattern Matching Problem

Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entri
es containing M, W or F.  Is there a way to do this?  

mysql select schdays from courses where schdays LIKE %MWF%;
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql select schdays from courses where schdays LIKE %M%;
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
%schdays%


H
ere is my code from the program:
my $sth2 = $dbh-prepare(select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \\%$cschdays\%\ AND
done=\Yes\etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
[EMAIL PROTECTED]

--
Douglas R. Brantz
Computer Consultant
Fine  Applied Arts
Appalachian State University
Boone, NC 28608

82
8-262-6549 (office)
828-262-6312 (fax)




-
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



---
Incoming mail
 is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

-
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

 



-
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




RE: Pattern Matching Problem

2002-01-29 Thread Bret Ewin

Since the days in a week are not likely to change, why not have an indexed
column for each day? For example,

select id from courses where day_m = 1 and day_t = 0 and day_w = 1 and day_h
= 0 and day_f = 1;

Wouldn't this approach be more efficient than a full table scan with regular
expression matching on each row? You could add two more columns, days_mwf
and days_th, to speed up the common queries.

Bret

-Original Message-
From: Matthew Walker [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 3:46 PM
To: Douglas Brantz; [EMAIL PROTECTED]
Subject: RE: Pattern Matching Problem


SELECT schdays FROM courses WHERE (schdays LIKE M) OR (schdays LIKE
W) OR (schdays LIKE F)

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-Original Message-
From: Douglas Brantz [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 1:15 PM
To: [EMAIL PROTECTED]
Subject: Pattern Matching Problem

Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entries containing M, W or F.  Is there a way to do this?  

mysql select schdays from courses where schdays LIKE %MWF%;
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql select schdays from courses where schdays LIKE %M%;
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
%schdays%


Here is my code from the program:
my $sth2 = $dbh-prepare(select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \\%$cschdays\%\ AND
done=\Yes\etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
[EMAIL PROTECTED]

--
Douglas R. Brantz
Computer Consultant
Fine  Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)




-
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



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

-
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

-
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




help please, patter matching problem

2002-01-12 Thread Dan

mysql and Perl

Can someone tell me what's wrong with this code:

$sth=$dbh-prepare(SELECT Contacts FROM Info WHERE Name=?);

$sth-execute(%$sname%);

$dname = $sth-fetchrow_array;

$names is supposed to be a substring. So if I want to search for a middle 
name or just a first name or even a last name.

Any help is greately appreciated.

Daniel.

-
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




RE: help please, patter matching problem

2002-01-12 Thread Roger Baklund

* Dan
 Can someone tell me what's wrong with this code:
 
 $sth=$dbh-prepare(SELECT Contacts FROM Info WHERE Name=?);
 
 $sth-execute(%$sname%);

You should use the LIKE operator:

Name LIKE %roger%

URL: http://www.mysql.com/doc/S/t/String_comparison_functions.html 

-- 
Roger

-
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




Re: help please, patter matching problem

2002-01-12 Thread Douglas Forrest

No closing quotes in prepare.

Also, I've never seen code that's looks quite like that; this may be
cleaner:

$sth=$dbh-prepare(SELECT Contacts FROM Info WHERE Name=%$sname%);

 $sth-execute();


- Original Message -
From: Dan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, January 12, 2002 9:49 AM
Subject: help please, patter matching problem


 mysql and Perl

 Can someone tell me what's wrong with this code:

 $sth=$dbh-prepare(SELECT Contacts FROM Info WHERE Name=?);

 $sth-execute(%$sname%);

 $dname = $sth-fetchrow_array;

 $names is supposed to be a substring. So if I want to search for a middle
 name or just a first name or even a last name.

 Any help is greately appreciated.

 Daniel.

 -
 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




-
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




Re: help please, patter matching problem

2002-01-12 Thread Douglas Forrest

Oops! And switch = to like and add quotes:

$sth=$dbh-prepare(SELECT Contacts FROM Info WHERE Name like '%$sname%' );

 $sth-execute();


- Original Message -
From: Douglas Forrest [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, January 12, 2002 4:16 PM
Subject: Re: help please, patter matching problem


 No closing quotes in prepare.

 Also, I've never seen code that's looks quite like that; this may be
 cleaner:

 $sth=$dbh-prepare(SELECT Contacts FROM Info WHERE Name=%$sname%);

  $sth-execute();


 - Original Message -
 From: Dan [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, January 12, 2002 9:49 AM
 Subject: help please, patter matching problem


  mysql and Perl
 
  Can someone tell me what's wrong with this code:
 
  $sth=$dbh-prepare(SELECT Contacts FROM Info WHERE Name=?);
 
  $sth-execute(%$sname%);
 
  $dname = $sth-fetchrow_array;
 
  $names is supposed to be a substring. So if I want to search for a
middle
  name or just a first name or even a last name.
 
  Any help is greately appreciated.
 
  Daniel.
 
  -
  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
 
 


 -
 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



-
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