How to duplicate a record

  • Hey,

    If I have a set of records, keep it simple with ID, User and Department:

    ID---------User------------Department
    1----------Joe Bloggs---Accounts
    2----------Jill Bloggs----Engineering

    On my web app I group by department, and show each person underneath. I'd like to have a favourites department per user, which is a simple intermediary table:

    ID-------Person---------User (this is the current logged in user)
    1---------Joe Bloggs---Jill Bloggs

    Now the result above for Jill Bloggs should now be.

    ID---------User------------Department
    1----------Joe Bloggs---Accounts
    2----------Jill Bloggs----Engineering
    3---------Joe Bloggs----Favourites

    The query for this resultset is quite complex so I'd like to avoid a union (and so repetition) if possible, but that is the result I want. Can I do a join to the intermediary table and have it show as an additional row with the fabricated department as 'Favourite'

    Thanks

  • I've totally binned this idea. I've instead fabricated an additional column which is bit (true if favourite, false if not).

Viewing 2 posts - 1 through 1 (of 1 total)

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