Need help badly

  • Hi friends I really need help I am stack and don't know what to do. I am working on a project for a friend who works I a hospital and his work is base on a shift pattern so the shift is give to him month in advance sometimes he does all the shifts and sometimes cancel some of them. I have ShiftTable, CanceledShiftTable and ShiftWorkedTable. What I have done is whenever a shift is worked or cancel then it is remove from the shift table so that he can access the remaining shifts he has and the shifts worked or cancelled but now he want to be to view all the shifts he has been booked with a certain period to see all the shifts he has been booked whether worked or cancelled. Can anyone help me so that I  stop deleting shifts when it is worked or cancel. I am using VB.net as front end. Thanks

  • Hi,

    I would recommend storing all of the shift information in one table adding a field called shift status (with the possible values of worked, cancelled or open).  If you have to use separate tables, try a UNION query to combine the data from the multiple tables.

    Thanks.

  • Brenna's solution looks to be the way to go.

    As an another alternativ could be a left join approche where you could have the shift table as main table and the worked and cancelled tables as child tables, somethying like this:

    select * from ShiftTable S

    left join ShiftWorkedTable W on S.shift_code = W.shift_code

    left join CanceledShiftTable C on S.shift_code = C.shift_code



    Bye
    Gabor

  • Yes - it all depends on whether there's a shiftID linking those 3 tables - then you can use what Gabor suggested -

    ...though it's still much neater and tidier to just keep all the info in one table instead of deleting from one and adding to another unnecessarily adding to the IO - if you wanted to redesign this you should follow Brenna's suggestion!







    **ASCII stupid question, get a stupid ANSI !!!**

  • Thanks guys I have redesgin it and I am now trying it.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply