Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all...
this query not working for some time
here empname and rollno is of type varchar
SQL
select * from emp where empname like '%Vaishnavi V%' or rollno like '%Vaishnavi V%' order by rollno

Vaishnavi V is the empname existed in database
it will return --> MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0005 sec )

when am giving like
SQL
select * from emp where empname like '%tulasi ram V%' or rollno like '%tulasi ram V%' order by rollno


the statement returns 1 record..
i have tried in many ways to get 'Vaishnavi V' this name it wont showing always returns empty records how can i get records of Vaishnavi V this person
can any one help me please
thanks in advance
Posted
Updated 10-Oct-11 3:21am
v2
Comments
Bala Selvanayagam 10-Oct-11 9:24am    
Are you sure that there is no additional space in the database in between "Vaishnavi" and "V"

what happens when you

select * from emp where empname like '%Vaishnavi%' or rollno like '%Vaishnavi%' order by rollno
tulasiram3975 10-Oct-11 10:41am    
i think it is problem with spaces between "Vaishnavi" and "V"

thanks which helps me
Bala Selvanayagam 10-Oct-11 11:22am    
cheers

1 solution

1. These name contain space in between, please make sure while entering you are searching same space mentioned in the database. When you are using like why you want the complete text ? just search Vaishnavi you should get the result
2. Put % after Vaishnavi V, Search can end with anything but need to start with Vaishnavi V
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900