cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe
CREATE TABLE WeekDay (DeliveryWeekdays INTEGER NOT NULL);

INSERT INTO WeekDay(DeliveryWeekdays) values (7);

We have a program that stores an int value in a table with which weekdays you have selected in a check box.

{
    None = 0,
    Monday = 1,
    Tuesday = 2,
    Wednesday = 4,
    Thursday = 8,
    Friday = 16,
    Saturday = 32,
    Sunday = 64,
}

alt text

Ex: If you have checked Monday and Thursday the value is 9 in the field in the table. If you checked Monday, Tuesday, Wednesday the value is 7 in the field and so on..

The question is whether with a date I can check if the day of the week in that date is in the int value stored in the table.

If I check the date 2020-10-08, I see that it is a Thursday. I want to check if Thursday is in value 7. The answer is yes. If the int value is 3, the answer will be no.

0 Likes
View Entire Topic
fvestjens
Participant
0 Likes

Is this what you're looking for:

select dow(current date) weekday, POWER(2,weekday-2) theday, (if (theday & 0x12) = 0 then 1 else 0 endif)