Answer the question
In order to leave comments, you need to log in
How to count the number of IDs by name and add the number to the result of another query?
Good afternoon,
There is a query that displays the number of clicks, form closes, unique visitors on my sites
SELECT site, year(date) as year, month(date) as month, day(date) as day, hour(date) as hour, SUM(w_init) as w_init, SUM(w_unique) as w_unique, SUM(w_close) as w_close FROM `f_click_log` where site='".$_val['name']."' AND date>='".$date_start." 00:00:00' AND date<='".$date_end." 23:59:59' GROUP BY year,month,site ORDER BY NULL
SELECT count(id) as orders, year(date) as year, month(date) as month, day(date) as day, hour(date) as hour FROM f_orders WHERE client='{$_val['name']}' AND date>='".$date_start." 00:00:00' AND date<='".$date_end." 23:59:59' GROUP BY year,month
Answer the question
In order to leave comments, you need to log in
Try this rubbish. Protest, esno, I can not. Therefore, in a general form, I give a request. To bring to mind.
SELECT fcl.site, year(fcl.date) as year, month(fcl.date) as month, day(fcl.date) as day, hour(fcl.date) as hour, COUNT(fo.id) AS orders, SUM(fcl.w_init) as w_init, SUM(fcl.w_unique) as w_unique, SUM(fcl.w_close) as w_close
FROM `f_click_log` AS fcl
INNER JOIN `f_orders` AS fo ON fcl.site = fo.client
WHERE fcl.site='".$_val['name']."' AND fcl.date>='".$date_start." 00:00:00' AND fcl.date<='".$date_end." 23:59:59'
GROUP BY fcl.year, fcl.month, fcl.site
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question