id product main_image
--- ---------- -----------
1 1 0
2 1 0
3 1 0
4 2 0
5 2 0
6 2 0
7 3 0
8 3 0
9 3 0
10 3 0
I want to use mysql query to make table field datas (for main_image) like this
id product main_image
--- ---------- -----------
1 1 1
2 1 0
3 1 0
4 2 1
5 2 0
6 2 0
7 3 1
8 3 0
9 3 0
10 3 0
how can I do it? I want to set a main image for products. I have about 3 millions record, I tried php but its too slow