write a sql query to check availability of dates from two tables

enter image description here

in the above table slots information is saved based on days.

enter image description here

on the second table slots which are not available are saved. Now i want to write a sql query which will only return free slots of particular date and then i want to add those slots in dropdown list. I have tried many queries but all in vain.

1 answer

  • answered 2021-02-20 08:02 scaisEdge

    Assuming the slot2 column can be use for matching the availability You could try with a left join and check for not matching rows

    select * 
    from table1 t1
    left join table2 t2 on t1.Slot2 = t1.Slot2 
    where t2.slot2 is null