While I am running this query
SELECT * FROM
tb_emp_daily_status d
where
d.shiftdate>='2017-06-07' and
shiftdate<='2017-06-13' and
emp_id in (SELECT id FROM tb_employee e WHERE e.user_id = '18145' LIMIT 20)
order by d.id asc
How to write this query in mysql
In mysql, you should be able to put as many values in the IN clause as you want, only constrained by the value of "max_allowed_packet".
In Denodo,at this moment Limit is only supported at the end of a SELECT statement to reduce the size of the result set but it cannot be used in subqueries.
MySQL Offset is used to specify from which row we want the data to retrieve. To be precise, specify which row to start retrieving from. Offset is used along with the LIMIT. Here, LIMIT is nothing but to restrict the number of rows from the output.
Try this:
SELECT * FROM
tb_emp_daily_status d
where
d.shiftdate>='2017-06-07' and
shiftdate<='2017-06-13' and
emp_id in (SELECT * FROM (SELECT id FROM tb_employee e WHERE e.user_id = '18145' LIMIT 20)
as t)
order by d.id asc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With