Queries that reference other queries - I'm lost!

So in Microsoft Access I used to have many queries I ran which references other queries. For example I had one that showed the most recent date which a client received an update disk with music content on the disk (i.e not a software update or blank disk)

I did this by creating query which showed all updates and their component types, saved this query as "All updates with component" . Then referenced this with a second query, like this:

SELECT [All updates with component].clientid, Max(All updates with component].timestamp) AS MaxOftimestamp FROM [All updates with component] GROUP BY [All updates with component].clientid;

How can I go about doing this in MySQL I don't seem to be able to store queries (other than to file) and then reference that query in a new query as if it were a table. This was so simple and easy in MySql but I am totally at a loss as to how to achieve this in MariaDB

Any help greatly appreciated!

Regards,

Molly

Answer Answered by Ian Gilfillan in this comment.

Looks like Common Table Expressions are what you're looking for.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.