title: SQL variables are not working in MariaDB
body: <p>In my query, I need to get the previous row with the current row and then join a few tables. I got the previous row by using SQL variables in my development server(MySQL 5.7), everything works fine, but in my production(MariaDB 10) server that previous row results are bad just mixed, bad part is only that previous row with SQL variables other query parts works good.</p>
  
  <p>My query:</p>
  
  <pre><code>                                  customers.title,
                                    calendar.start_time, 
                                    calendar.hours_per_time,
                                    calendar.self_certification,
                                    calendar.bulletin_certification,
                                    calendar.extra,
                                    @previous_start AS previous_start,
                                    @previous_start := calendar.start_time,
                                    @previous_end AS previous_end,
                                    @previous_end := calendar.hours_per_time,
                                    DATE_FORMAT(calendar.date, '%d-%m') AS day_month,
                                    TIME_FORMAT(calendar.start_time, '%H:%i') AS hours_min
  
          FROM
            (SELECT @previous_start := '00:00', @previous_end := '0.00') AS calendar_prev, calendar
  
              INNER JOIN relationships ON calendar.relation_id = relationships.relation_id
              INNER JOIN customers ON customers.customer_id = relationships.customer_id
              WHERE relationships.user_id = '$user_id'
              AND DATE_FORMAT(calendar.date, '%m-%Y') = '$date'
          ORDER BY calendar.date, hours_min ASC
  </code></pre>