dbTalk Databases Forums  

Matching problem

mailing.database.myodbc mailing.database.myodbc


Discuss Matching problem in the mailing.database.myodbc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Matching problem - 05-09-2006 , 08:17 AM






Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: "87682<next>39857"

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/mysql?unsub=m...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Matching problem - 05-09-2006 , 08:23 AM






Barry schrieb:
Quote:
Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: "87682<next>39857"

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/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Matching problem - 05-09-2006 , 08:29 AM



Barry wrote:
Quote:
Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: "87682<next>39857"

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/...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?

Quote:
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/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
AT
 
Posts: n/a

Default Re: Matching problem - 05-09-2006 , 08:32 AM



Wolfram Kraus schrieb:
Quote:
Barry wrote:
Hello everyone!

I have a slight problem matching rows.

My problem is the Value in a textfield is: "87682<next>39857"

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/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
  #5  
Old   
AT
 
Posts: n/a

Default Re: Matching problem - 05-09-2006 , 08:34 AM



إيز»·² schrieb:
Quote:
try this:
WHERE concated_field LIKE '87682%'
or
WHERE concated_field LIKE '87682<next>_____'

would give me 876825 what i am not looking for.
And i were also looking for <next>87682.

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/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
  #6  
Old   
AT
 
Posts: n/a

Default Re: Matching problem - 05-09-2006 , 08:37 AM




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

Quote:
WHERE concated_field LIKE '%87682%'
No, because that would also match numbers that contain that sequence
like '187682<next>32876825'.

Quote:
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
marcus (AT) synchromedia (DOT) co.uk | http://www.synchromedia.co.uk


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
  #7  
Old   
AT
 
Posts: n/a

Default Re: Matching problem - 05-09-2006 , 08:41 AM



Marcus Bointon schrieb:
Quote:
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 '187682<next>32876825'.

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/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
  #8  
Old   
AT
 
Posts: n/a

Default Re: Matching problem - 05-09-2006 , 08:43 AM



Marcus Bointon wrote:
Quote:
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 '187682<next>32876825'.
WHERE concated_field LIKE '87682<%' OR concated_field LIKE '%>87682'

Still poor performance ;-)

[...]
Quote:
Marcus

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.