Hey there well I have two tables that I would like to join together, I don't know if JOIN is the proper function either.
Anyway here goes:
This table holds the actual sales per site, customid is the id that made the sale, each one of these results return 1 sale, and it tells which id made the sale. In here there are two sales for customid 8, and they were both on the same date.
table1 {
id
date
customid
}
insert into table1 (id, date, customid) VALUES('1', '2008-04-08', '8')
insert into table1 (id, date, customid) VALUES('2', '2008-04-08', '8')
this table has information about the customid that made the sale, the title for example of the customid, currently only customid 8 has made a sale.
table2 {
customid
title
}
insert into table1 (customid, title) VALUES('8', 'Jim Rocks');
insert into table1 (customid, title) VALUES('2', 'Mike Solomon');
this table holds the statistical data for the sales, from the insert data, If i filter by 2008-04-08, i get four results, i need to be able to get the sum of "hits" and "joinhits" for that particular customid.
table3 {
date
hits
joinhits
customid
}
insert into table1 (date, hits, joinhits, customid) VALUES( '2008-04-07', '58', '433', '8')
insert into table1 (date, hits, joinhits, customid)) VALUES('2007-05-08', '58', '433', '8')
insert into table1 (date, hits, joinhits, customid)) VALUES('2008-04-08', '58', '433', '8')
insert into table1 (date, hits, joinhits, customid)) VALUES('2008-04-08', '58', '433', '8')
insert into table1 (date, hits, joinhits, customid)) VALUES('2008-04-08', '30', '433', '8')
insert into table1 (date, hits, joinhits, customid)) VALUES('2008-04-08, '58', '433'', '8')
If i were to run the query this is the results I should get.
Thank you, you have searched for 2008-04-07
Title Hits Joinhits
Jim Rocks 204 1612
I would also like to do date ranges.
Start Free Trial