I have 3 tables Channels, DateSelection and History. Channels and DateSelection are updated as needed and are typically like below Channels Table -
CHID CHNAME CHLOC
1 BARRY NULL
2 TOM NULL
3 SHIRLY NULL
DateSelection Table
WEEKCOMMENCING WEEKENDING
01/01/2014 03/01/2014
History Is Empty with columns - Channel - Date - User
What i would like to do is run a query or trigger mysql or php etc that would make rows of
Channel - Date - User
Barry 01/01/2014
Barry 02/01/2014
Barry 03/01/2014
Tom 01/01/2014
Tom 02/01/2014
Tom 03/01/2014
Shirly 01/01/2014
Shirly 02/01/2014
Shirly 03/01/2014
Essentially every possible combination?
I have got it sort of working with the following in a view. and doing each day independently
INSERT INTO FCHISTORY
(CHNAME, DATE)
SELECT Channels.CHNAME, FCCURRENTDATES.DATE
FROM Channels
CROSS JOIN FCCURRENTDATES
However this creates duplicates constantly. What can I add to only have 1 of each matching combination of CHNAME and DATE
Can someone help me out here? I dont mind doing it in a one day at a time way but there is actually a cpl hundred channels. Thanks!