Using the example table below, as of now I have: UPDATE wc_bidsys_picklist SET vipplays = 'YES' WHERE playoftheday = 'YES';
Is this much correct? If so how can I also add: "within a specific range that is set by the column (game_date) field values?" Range between '2016-06-29 00:00:00' through '2017-06-29 00:00:00'. Is this even possible?
My specific question in detail: (partially answered above)
Using my example below for a table called 'wc_bidsys_picklist': Using SQL is there a way to update the value ('NO' to 'YES') of each field in a specific column (vipplays) only if it does NOT equal the field of a different specific column (playoftheday) so the fields in both of these columns end up having matching values ('YES') while within a specific range set by a 3rd column (game_date)?
In more simple terms I need to say "In column (game_date) from '2016-06-29 00:00:00' through '2017-06-29 00:00:00' if the field value in the column (playoftheday) = 'YES' and the field value in the column (vipplays) = 'NO' then UPDATE the field value in the column (vipplays) to 'YES'. How, if possible, can this be written in SQL?
UPDATE: After a few updates to the fiddle this one seems to work.
My fiddle: http://sqlfiddle.com/#!9/69cf4/1/0
CREATE TABLE wc_bidsys_picklist
(`id` int, `game_date` datetime, `playoftheday` varchar(5), `vipplays` varchar(5))
;
INSERT INTO wc_bidsys_picklist
(`id`, `game_date`, `playoftheday`, `vipplays`)
VALUES
(1, '2016-07-01 00:00:00', 'YES', 'NO'),
(2, '2016-07-03 00:00:00', 'YES', 'YES'),
(3, '2016-07-04 00:00:00', 'YES', 'NO'),
(4, '2016-07-04 00:00:00', 'YES', 'NO'),
(5, '2016-07-06 00:00:00', 'YES', 'NO'),
(6, '2016-07-07 00:00:00', 'YES', 'YES'),
(7, '2017-06-08 00:00:00', 'YES', 'NO'),
(8, '2017-06-29 00:00:00', 'YES', 'NO')
;
UPDATE
wc_bidsys_picklist
SET
vipplays = 'YES'
WHERE
playoftheday = 'YES'
AND
(game_date BETWEEN '2016-07-01 00:00:00' AND '2017-06-29 00:00:00');
On a side note I would like to reiterate that I am relatively new to this community and programming. I don't understand why all the immediate down votes. It seems like members are more interested in correcting posts and bullying new users rather than helping you out. And apparently I'm not the only one: https://hackernoon.com/the-decline-of-stack-overflow-7cb69faa575d It's an interesting read.