Select all rows after the LATEST row that has attributeA = 1

70
January 19, 2021, at 6:30 PM
|------------------------------------------------|
| id |    user_id   | mes_date     |  attributeA |
|------------------------------------------------|
| 1  | 8             | 2019-01-18  |      0      |  
| 2  | 12            | 2019-01-16  |      1      |   
| 3  | 12            | 2019-02-20  |      1      | 
| 4  | 12            | 2019-03-23  |      0      |  
| 5  | 9             | 2019-02-24  |      1      |  
| 6  | 9             | 2019-02-24  |      1      |  
|------------------------------------------------|

How can I do that with one query?

Basically it's "select all the rows of that user, after he had AttributeA = 1 for the last time"

In this case, I want to select user_id 12:

    |------------------------------------------------|
    | id |    user_id   |  mes_date    |  attributeA |
    |------------------------------------------------|
    | 3  | 12            | 2019-02-20  |      1      | 
    | 4  | 12            | 2019-03-23  |      0      |  
Answer 1
SELECT t1.id, t1.user_id, t1.mes_date, t1.attributeA
FROM mytable AS t1
JOIN (
  SELECT user_id, MAX(id) AS id FROM mytable WHERE user_id = 12
) AS t2 ON t1.user_id = t2.user_id AND t1.id >= t2.id
READ ALSO
NodeJS checking if XML element exists and add or delete

NodeJS checking if XML element exists and add or delete

I'm working with XML in NodeJSI've been using the xmlbuilder to create my XML

68
Extracting array value from nested array of objects

Extracting array value from nested array of objects

Hi guys i have created the following array of objectsAnd to be honest i am a little bit lost

106
How to use CloudFireStore on Android Stuido

How to use CloudFireStore on Android Stuido

I want to use CloudFireStore From Firebase How can I start It on Android Studio Project

81
Trouble Hosting Angular/Core App - Failed to load module script: The server responded with a non-Javascript MIME type

Trouble Hosting Angular/Core App - Failed to load module script: The server responded with a non-Javascript MIME type

I have been trying to figure this out for a while nowWhenever I'm trying to host the simple Angular hello world app with Dotnet core, my browser is struggling with the MIME types of the javascript modules and the CSS

137