I would like some help. I have two tables:
Table 1: I have the project request data by the user. I will always have the last request record for a given project for a given user. The username and project name are PRIMARY.
enter code here
Table 2: I have the records of each request by the project. In this table, I have a column that ranks the status of each project. I don't have user information in this table, it's just related to project data. I need to filter all requested users and projects (Table 1), but highlight the status of each project.
My query:
SELECT users.name, request.identifier AS 'Project',
CASE
WHEN attribute.value = 1 THEN 'Not started'
WHEN attribute.value IN (2,3) THEN 'Data partially available
WHEN attribute.value = 3 THEN 'Full data available
END AS Status,
COUNT(request.identifier) AS 'Quantity votes'
FROM user_prioritization_request request
LEFT JOIN issuer_attribute attribute ON (request.identifier = attribute.identifier)
INNER JOIN user users on (users.username = request.username)
GROUP by request.identifier, users.name, Status
ORDER BY 'Quantity votes' ASC
I would like to know how I can do this.
Thanks. Bianca