Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. SELECT TableD.receiveID,TableA.bedNAME,TableC.bedPrice,TableD.TotalPrice,TableD.OperatorID
  2. FROM TableD
  3. LEFT JOIN TableC ON TableC.receiveID=TableD.receiveID
  4. INNER JOIN TableB ON TableB.operatorID=TableD.operatorID
  5. RIGHT JOIN TableA ON TableA.bedID = TableC.bedID
  6. WHERE TableD.TotalPrice != 0
  7. GROUP BY TableD.receiveID
  8. ORDER BY TableD.receiveID
  9.  
  10. Code gives me following result:
  11. <receiveID bedNAME bedPrice TotalPrice operatorID
  12. 1 a123 35.50 100.00 1 >
  13.  
  14.  
  15. The problem is that there is more than one bedNAME with receiveID=1. When i erase group by then the result is:
  16.  
  17. <receiveID bedNAME bedPrice TotalPrice operatorID>
  18. < 1 a123 35.50 100.00 1 >
  19. < 1 a234 64.50 100.00 1 >
  20.  
  21. What I need is:
  22.  
  23. <receiveID bedNAME bedPrice TotalPrice operatorID
  24. 1 a123 35.50 100.00 1
  25. a234 64.50 100.00 1 >
  26.  
  27. This is my first question here, I apologise if this question is trivial or badly composed. Thank you!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement