Hi,
I am sure this will be easy sql command for experts but I am just learner so its hard for me how to do this.
I have two tables.
1. Campaign
camp_id
camp_name
order_date
status
2. Visitors
camp_id
date
ip
I want to do the following:
- select all campaigns with status “active”
- one column with title “Today” with total of all visitors of campaign for today’s date ONLY
- one column with title “Total” with total of all visitors of campaign all time
I used this command and its working fine.
SELECT camp.order_date,camp.camp_id,camp.camp_name,count(vis.ip) as Total FROM `campaign` camp JOIN `visitors` vis on camp.camp_id=vis.camp_id where camp.status='Active' and vis.date='2016-12-28' group by camp.camp_idBut I want to add another column which can total all visitors (count(ip)) without date filter.
Please help me how to do this.