Donate

MySQL Subquery Result As Aliased Table Name

Here's a query that has a subquery in which the result
is aliased as inner table and then the outer query compares the result from the subquery against the field in the outer query.
SELECT id,w_id, start, f_count, count_percent
  FROM tblLogs,
    (select max(id) as max_id from tblLogs where w_id = 92 
       and categ = 'bike' and 
            date(start) = '2012-01-24') as inner_table
WHERE DATE(start) = '2012-01-24'
AND w_id =92
AND categ = 'bike'
and err = 'none'
and remark = ''
and inner_table.max_id = tblLogs.id;

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.