1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help with MySQL trigger / loops

Discussion in 'MySQL' started by PoPSiCLe, Jan 12, 2013.

  1. #1
    Hi. I have a table in my database which contains the following:

    timesheet_days:
    tt_id, tt_name, tt_1, tt_2, tt_3, tt_4, tt_5. tt_6, tt_7 - where the tt_X represents each day of the week.

    This table is populated by a trigger from another table when a new location is placed into another table. This works just fine.

    Now I want to populate another table with work-shifts when there is a new entry into this table.

    Making a trigger which makes an entry into the shift-table isn't a problem, but I want one entry pr. day - something like this:

    When a new entry is entered into timesheet_days -> trigger -> new entries are made into the timesheet_shifts table for each day

    This means I need to loop through the different days (tt_X) in one row in the timesheet_days table

    Anyone have a code akin to this available?

    I'm fairly new to triggers, and this has got me stumped
     
    PoPSiCLe, Jan 12, 2013 IP