Answer the question
In order to leave comments, you need to log in
How to make 4 selections from 2 tables sorted by 1 key?
There is such a request
SELECT * FROM
(SELECT `date`, COUNT(`hard`) AS `count` FROM `statistic` GROUP BY `date`) T1,
(SELECT `date`, COUNT(DISTINCT`hard`) AS `uniq` FROM `statistic` GROUP BY `date`) T2
WHERE T2.date = T1.date
SELECT * FROM
(SELECT `date`, COUNT(`ip`) AS `count` FROM `download` GROUP BY `date`) T1,
(SELECT `date`, COUNT(DISTINCT`ip`) AS `uniq` FROM `download` GROUP BY `date`) T2
WHERE T2.date = T1.date
Answer the question
In order to leave comments, you need to log in
Well, I decided probably not the right and long but working method.
The final request is like this
SELECT * FROM
(SELECT `date`, COUNT(`hard`) AS `count` `, COUNT(DISTINCT`hard`) AS `uniq` FROM `statistic` GROUP BY `date`) T1,
(SELECT `date`, COUNT(`ip`) AS `ipcount`, COUNT(DISTINCT`ip`) AS `uniqip` FROM `download` GROUP BY `date`) T2
WHERE T2.date = T1.date
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question