I could not be more specific in terms of the name, but I want to do something a little complicated for me. I thought I did, but it turned out to be buggy.
I have three tables:
Projecttable
OfferTable
- idOffer
- idProject
- idAccount
AccountTable
Now, in one request, I am going to list all projects with the majority of the proposals made, and in the request I also want to receive data, such as the name of the owner, the name of the provider * , etc. Therefore, I do not need to request each project again.
Here is my broken request, this is my first experiment with GROUP BY, and I probably did not quite understand it.
SELECT Project.addDate,Project.idOwner ,Account.Username,Project.idProject, Project.Price,COUNT(Project.idProject) as offercount FROM Project INNER JOIN Offer ON Project.idProject= Offer.idProject INNER JOIN Account ON Account.idAccount = Project.idOwner GROUP BY Project.addDate,Project.idOwner, Account.Username,Project.idProject,Project.Price ORDER BY addDate DESC
*: I wrote that, without thinking, I was just trying to come up with an example of additional information, which is pointless thanks to the Khosam Ali.
source share