N. Kavithashree wrote:
when i retrieve records using follwg query :
select * from table where country='United States' and code='US';

Is the value if the country field "United States"? Or is it "United States of America" or similar?


But if i give :s
select * from table where country like 'United S%' and code='US'; it works

This makes sense if the value is not "United States". The expression "country='United States'" will only match rows where the country column exactly matches the string 'United States'. If you want to match a part of a column, you can use the LIKE operator and a % character, like in your last example. Just remove "and code='US'".


If the value of the column actually is "United States", try this to "prove" it:

SELECT concat('"',country,'"') country,length(country)
  FROM table WHERE code='US';

--
Roger


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



Reply via email to