1

The basic syntax for this generally involves inserting into one table by selecting from another, which would look something like: INSERT INTO t1 (a1, b1) SELECT a2, b2 FROM t2 WHERE a2 > 0 AND b2 > 0 ; There is some flexibility in that, although perhaps not as much as you are looking for. It might be worth ...


1

SELECT * FROM ( full text of query 1 ) WHERE (condition 1) UNION ALL SELECT * FROM ( full text of query 2 ) WHERE (condition 2) AND NOT (condition 1) Neither condition must give NULL (due to NULL in field/variable values) in NOT. Outer SELECTs for each separate subquery in UNION may be excess if separate queries are not complex. For the code shown in ...


1

I fixed it by adding the feed_id field to the ORDER BY clause like that: mysql> EXPLAIN SELECT a.id FROM articles a WHERE a.feed_id IN (6826,6827) AND a.date < 1564469723.424363 ORDER BY a.date DESC, a.feed_id DESC LIMIT 20; +----+-------------+-------+-------+-------------------+--------------+---------+------+------+----------------------------------...


Only top voted, non community-wiki answers of a minimum length are eligible