• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I have a question....

 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I try to find in all bugs description and get the list of bugs that "for" word is on it butI guess my query is not correct.
Could you help me on this?
Many thanks,
Elahe

wrapped long query line
[ July 13, 2002: Message edited by: Frank Carver ]
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your query will only return records with the exact description 'for', and I guess there aren't many of those. Try something like:
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Frank
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
In my query, I like to simulate my where condition part based on what I have:
upper(bdesc) like '%for%'

But there is some thing wrong in puting double code or single code... could you please help me how can I do it?
Eventually my query would be like:

Many thnaks,
Elahe
[ Edited by Dave to reduce the length of the line ]
[ July 16, 2002: Message edited by: David O'Meara ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if this is your problem, but you are missing spaces

Dave
 
s basetti
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess u made the query bit complex..
select s.text,b.bdesc,
b.fixedDate,
b.contact,
u.name
from bug b,
user u,
statusDesc s
where b.ID=s.ID
and b.userId=u.userId
and " + strWhere + " //strWhere = "upper(b.bdesc)like'"+%Desc%"+"'";
order by "+ strOrder);
..may be space problem..
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,
Yes the problem was space and something else that still I couldn't figure out so I break it in two lines to make sure it is working:
strX = "%"+ strX + "%";
strWhere = "upper(b.bdesc) like'"+strX+"'";
Can you please help me to make it just one line? since I don't want to have two lines...I really have no idea how can I make it one line...
Thanks a lot,
Elahe
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by elahe shafie:
Dear Friends,
Yes the problem was space and something else that still I couldn't figure out so I break it in two lines to make sure it is working:
strX = "%"+ strX + "%";
strWhere = "upper(b.bdesc) like'"+strX+"'";
Can you please help me to make it just one line? since I don't want to have two lines...I really have no idea how can I make it one line...
Thanks a lot,
Elahe

how about:

you should probably escape illegal characters in your string like single quotes. I threw in the String.upperCase() function on your compare string just in case you forgot to do it earlier. I also added spaces so that you don't run into spacing problems when you concatenate the String to your query( you can always have more than one but need at least one before the string and one after ).
Jamie
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jamie you are great like always. It works!!!
Thaaaaaaaaaaaanks
Elahe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic