|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I have this weird extraction of data from a column for which I am not sure how to put the query. Example: Let us say the table Table1 has column "ParcelNo" with values shown. Table1: ParcelNo ------------ 21-912-60-03 11-912-60-03 129-16-0-033 If a user enters to search for parcel No: "2-91-6-0". I need to strip the dashes and the search variable becomes "29160". The return from a SELECT on the ParcelNo field with value "29160" should return values: (21-912-60-03 and 129-16-0-033) and will not return (11-912-60-03). The way it extracts is in the order of the number. It will not extract the second record value because there is no 2 before 9. Req: It should check that the Parcel No has all the numbers from the "21960" plus it should be arranged in the same order. However any other number/dash could be in between. Please help me find a solution to this? thanks Tina |
|
#2
|
||||
|
||||
|
You should be able to just wildcard your search. I'm not sure what languages you're working with but in PHP/MySQL, I'd do something like this:
PHP Code:
This will give you the query: SELECT * FROM Table1 WHERE ParcelNo LIKE '%2%9%1%6%0%' which should work for you.
__________________
"Not to offend our Swedish listeners ... if we have any, that is—" "—But your team's rubbish." (Sun webcast, Sweden vs. Paraguay) Who needs corporate radio? WeFunkRadio.com | Global Pop Conspiracy | Radio Paradise | SomaFM | The Classic Soul Network | Boot Liquor | WFMU Freeform Radio |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > convoluted extraction of data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|