This is a MICROSOFT SQL SERVER forum.
If you are using MySQL, you should post your question in an appropriate MySQL Forum.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How to achieve this using Mysql
Thanks in advance
Jo
This is a MICROSOFT SQL SERVER forum.
If you are using MySQL, you should post your question in an appropriate MySQL Forum.
You could try to write a CTEs for each column with the Distinct _ReportId and Field. Then join these on cte._ReportId = _ReportID
Beside the correct tag azure-mysql-database, you have tagged your question with two SQL Server tags, which I why I see your question. SQL Server and MySQL are two different products, and query that runs on SQL Server may not run on MySQL and vice versa.)
However, there are still a few things I like to comment. First off all, when asking for help like this, it is a lot better to share data as CREATE TABLE statements for your table and INSERT statements for the data. We cannot copy and paste from images.
Next, the problem does not seem solvable. You have a number of rows you want to consolidate into two. The problem is, how do we know that Low-grease auto-level
goes together with Auto-Grease All Level OK
and Number = 9? If you say "because they all come first in a pair", let me remind you that a table by definition is a unordered set of data. So unless there is something that encodes the order on every row, what you ask for is not possible.
Then again, from where did you get this data? Somehow, this seems to me like the result of a previous query. Maybe you went wrong at a previous step.