Skip to content
Advertisement

SQL Statement to create a table as a result of a count operation?

Let’s say you got a table like this

and you want to end up with a report like this;

So you run this over the first table

So far so good.

But the above SQL statment puts the report view on the browser. Well, I want to save that data into a SQL.

So, what SQL command do I need to insert the results of that report into a table?

Assume that you already created a table called reports with this;

Let’s assume that the reports table is empty and we just want to populate it with the following view – with a one-liner. The question I’m asking is how?

Advertisement

Answer

As simple as that:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement