(Nov-11-2017, 12:50 AM)Larz60+ Wrote: you are running the inner loop with same data 10 times for each iteration of outer loop, why?
well I dont want to run the inner loop with same data 10 times.
When I try this:
if value == program_id: cur.execute("UPDATE programs SET program_id=? WHERE start_date=?",(value, next_day))It will insert the data into the database like 11 times:
Output: channel | start_date | program_id
101 BBC One South E | 20171111230000 | 3061
101 BBC One South E | 20171111233000 | 3062
101 BBC One South E | 20171112000000 | 3063
101 BBC One South E | 20171112013500 | 3064
101 BBC One South E | 20171112014000 | 3065
101 BBC One South E | 20171112060000 | 3066
101 BBC One South E | 20171112090000 | 3067
101 BBC One South E | 20171112102000 | 3068
101 BBC One South E | 20171112123000 | 3069
101 BBC One South E | 20171112133000 | 3070
101 BBC One South E | 20171112165500 | 3060
102 BBC Two | 20171111232500 |
102 BBC Two | 20171112010000 |
102 BBC Two | 20171112023500 |
102 BBC Two | 20171112060500 |
102 BBC Two | 20171112065000 |
102 BBC Two | 20171112073500 |
102 BBC Two | 20171112083500 |
102 BBC Two | 20171112093000 |
102 BBC Two | 20171112130000 |
102 BBC Two | 20171112140000 |
Do you know how I can insert the 3001
to 3010
in the same rows as the next_day
data??