我怎样才能使这样的工作?
INSERT INTO age.page(domain,title_count,youtube_count,ipaddress,updated)
SELECT * FROM
(
SELECT domain,
COUNT(domain) AS titlecount,
(SELECT COUNT(*) FROM table2 WHERE title = table1.title) AS YoutubeCount, ipaddress
NOW() AS timeNow
FROM table1
GROUP BY domain
ORDER BY title DESC
) a;
我想使用子查询来获取不同表的计数,但使用主查询中的相同字段。
我想这样做的原因是我不必运行两个查询,而是只运行一个。