If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Error on case query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-28-09, 07:09
wussupbuddy wussupbuddy is offline
Registered User
 
Join Date: Apr 2009
Posts: 6
Error on case query

I'm getting an error while trying to execute the following statement. What's wrong with it?

"Select * from master where case(isnull(firstname) when 1 then '' else firstname end +' '+ case(isnull(lastname) when 1 then '' else lastname end like '%" & Text1.Text & "%'"
Reply With Quote
  #2 (permalink)  
Old 04-29-09, 06:18
ashish_mat1979 ashish_mat1979 is offline
Registered User
 
Join Date: Aug 2005
Posts: 30
Try using "CONCAT" for joining your case results instead of "+"

"Select * from master where CONCAT(case(isnull(firstname) when 1 then '' else firstname end ,' ', case(isnull(lastname) when 1 then '' else lastname end) like '%" & Text1.Text & "%'"

If even then not getting success show what exact error is occurring.
__________________
Ashish
Entertainment Overloaded
Reply With Quote
  #3 (permalink)  
Old 04-29-09, 06:23
wussupbuddy wussupbuddy is offline
Registered User
 
Join Date: Apr 2009
Posts: 6
that worked..thnx
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On