Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wrong query?

 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I try to get the list of bugs where status IS NOT resoved here is my quesry but it doesn't give me the right answer could you please tell me what part I am wrong?
Many thanks,
Elahe
 
Bonnie Beach-Morin
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your problem probably lies in the 's.text NOT IN ('resolved')' portion of your statement.
The IN keyword usually expects a list of things or a return from another statement.
Try using "s.text != 'resolved" instead.
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bonnie I tried your suggestion but still the answer is not correct
any advice....
Elahe
select s.text,b.bugNumber,b.bdesc,b.submittedDate,b.fixedDate,b.userID,b.contact,u.name from bug b, user u, statusDesc s where b.ID=s.ID and b.userId=u.userId and s.text != 'open' and u.name= 'JDR'
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select s.text,b.bugNumber,b.bdesc,b.submittedDate,b.fixedDate,b.userID,b.contact,u.name from bug b, user u, statusDesc s where b.ID=s.ID and b.userId=u.userId and s.text != 'resolved' and u.name= 'JDR'
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I fond out on simple query this part:
s.text != 'resolved'
is correct but there is some thing wrong in my whole query that gives me rong resuld!!!
I want my query gives me the list of bug(date, desc,...) that assigned to the persom that name= Jim and status is not resolved.
What did I do wrong?
Thanks,
Elahe
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry name='JDR'
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elahe, does your query return too many results, not enough, we need more info on what is going wrong to help you. Also, table structures are important when creating a join. Make sure you join on all primary/foreign key pairs. Beware of the cartesian product!
Jamie
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jammie and Bonnie,
It works and now I am getting right result.
Thank you sooooo much for your support like always,
Elahe
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic