Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT TableD.receiveID,TableA.bedNAME,TableC.bedPrice,TableD.TotalPrice,TableD.OperatorID
- FROM TableD
- LEFT JOIN TableC ON TableC.receiveID=TableD.receiveID
- INNER JOIN TableB ON TableB.operatorID=TableD.operatorID
- RIGHT JOIN TableA ON TableA.bedID = TableC.bedID
- WHERE TableD.TotalPrice != 0
- GROUP BY TableD.receiveID
- ORDER BY TableD.receiveID
- Code gives me following result:
- <receiveID bedNAME bedPrice TotalPrice operatorID
- 1 a123 35.50 100.00 1 >
- The problem is that there is more than one bedNAME with receiveID=1. When i erase group by then the result is:
- <receiveID bedNAME bedPrice TotalPrice operatorID>
- < 1 a123 35.50 100.00 1 >
- < 1 a234 64.50 100.00 1 >
- What I need is:
- <receiveID bedNAME bedPrice TotalPrice operatorID
- 1 a123 35.50 100.00 1
- a234 64.50 100.00 1 >
- 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