View previous topic :: View next topic
|
Author |
Message |
karthik_sripal
New User
Joined: 28 Mar 2008 Posts: 69 Location: 125.16.180.5
|
|
|
|
Hi all,
I need to fetch all the rows where spaces is a part of column value with some restriction
For example:
my table structure is like
Code: |
sno(int) Country(char30)
1 United
2 United States
3 India
4 Eastern Europe
|
My qury should fetch only the rows corresponding to "united States" and "Eastern Europe" only
Currently am struck up with a query like this
Code: |
SELECT *
FROM Country_table
WHERE
Country LIKE ' '
|
This query fetches everything as the value india is "indiabbbbbbb " (where b stands for spaces)
Kindly help me in solving this.hope am clear. please write back if am not clear.
Thanks [/code] |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Try and let us know ..
Code: |
SELECT * FROM Country_table
WHERE LENGTH(RTRIM(COUNTRY)) > LOCATE(' ',COUNTRY,1);
|
if working please test for different cases ... |
|
Back to top |
|
|
karthik_sripal
New User
Joined: 28 Mar 2008 Posts: 69 Location: 125.16.180.5
|
|
|
|
Thank you very much Ashimer,
It works, as exactly i need |
|
Back to top |
|
|
|