Quantcast
Viewing all articles
Browse latest Browse all 13329

Can I make columns on same table rec return as separate recs on rs?

I've been lurking for a while just reading things when I had time but have finally got a real question so this is my first post.

Have a very simple 97 DB with a table used to track attendees & their guests for a banquet. This table is linked to a production SQL Server DB to “preload” employee/spouse info. As RSVP’s are returned, the EmpAttending and GuestAttending flags are set accordingly. When Name Badges are printed, I want to sort the results by Employee but if they have a guest, the guest Name Badge should print next so they stay paired for the check-in table as some guests could have a different last name. Name Badges are a single Report that prints 2 across X 4 down the page.

AwardsBanquet table layout is roughly this:
EmpLastName text
EmpFirstName text
EmpAttending yes/no
GuestLastName text
GuestFirstName text
GuestAttending yes/no

Used this SQL for a report that only prints the spouses name next to Employee if they are also attending:
SELECT emplastname, empfirstname, RTRIM(empfirstname) & “ “ & RTRIM(emplastname) AS empfullname, SWITCH(guestattending=-1, RTRIM(guestfirstname) & “ “ & RTRIM(guestlastname)
FROM awardsbanquet
WHERE empattending=-1
ORDER BY emplastname, empfirstname

But I don’t have any idea how to write a select to deliver the data like I need for printing these labels sorted by Employee but keeping the guest paired IF they are taking one. Any suggestions would be greatly appreciated.

Thanks guys/gals, Bryan

Viewing all articles
Browse latest Browse all 13329

Trending Articles