MySQLjoin关联表查询时,查询字段前面加上表名更高效
原创join关联表查询时,查询字段前面加上表名更高效
SELECT
nft_publish.id,
nft_publish.author,
nft_publish.nft_name AS name,
nft_publish.display_url,
nft_publish.publish_count AS total_count,
nft_publish.sell_status,
nft_publish.sell_price AS price,
nft_publish.favorite,
count(
IF
( nfts.STATUS = 0, nfts.id, NULL )) AS rest_count
FROM
nft_publish
LEFT JOIN nfts ON nfts.nft_publish_id = nft_publish.id
WHERE
nft_publish.task_status = 7
GROUP BY
nft_publish.id
HAVING
rest_count > 0
ORDER BY
nft_publish.id DESC
LIMIT 20 OFFSET 0

版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
上一篇:Redis缓存穿透、缓存击穿、缓存雪崩 下一篇:SQL语句优化的30种方法
itfan123




