Sorry wasn’t sure how title this…
I’m trying to create a simplified solution for when people preregister for trades shows. In my form I have one company name input field, and multiple name input fields. This works fine.
However when it comes to checking in the names that were entered for the trade show, it checks (as check-in all for the trade show) all the names in under that specific company.
Instead of having it check in all the names at the same time (not everyone is going to show together/or at the same time), is it possible to check each name in separately?
I haven’t posted any code yet, I just want a hypothetical answer for now whether this is possible to do, I assume it is, I just haven’t quite figured it out yet.
I would hope you’ve set it up so the trade show events, the company, and the people attending are stored in three different DB tables. If so, the people attending could easily be marked as checked in.
No I didn’t, i currently had everything in one at the moment. So if i’m understanding this correctly, I should have table for the company, the people, and the checked-in?
I would have a table for events.
- event name
- any other event details
- company name
- any other company details
Guests(or another name)
- guest name
- company id
- event id
- checked in
You could then do a basic query like so.
e.id AS event_id
, e.date AS event_date
, g.id AS guest_id
FROM events AS e
LEFT JOIN guests AS g
ON g.event_id = e.id
LEFT JOIN company AS c
ON c.id = g.company_id
is there a difference between left joins and inner joins, would it make a difference which one was used?
INNER JOIN will require that there is a matching value in both tables to give you a result.
LEFT JOIN will show all results from first table and IF there is a matching value in second table those records will be included.
Say you have an event but NO ONE has signed up:
INNER JOIN will find NO MATCH in guests table and will return no results.
LEFT JOIN will list the events.
I almost always use LEFT JOIN.
This is a pretty good image of joins.
that’s probably the best description of joins I’ve had, I’m going to attempt to get this to work lol, I’m sure I’ll have more questions in the future in regards to this. Thanks!
A good graphic.
Left Joins say: “Give me all the information in table A. If there is matching information in table B, include it in the row, else NULL.” (“I want to see information about my events. Even the empty ones.”)
[Right joins are left joins, just arranged backwards]
Inner Joins say: “Give me only the rows for which there is information in both table A and table B.” (“I want to see companies that are sending guests to this event.”)
Full (Outer) Joins say: “Give me all the data from both tables. Line them up where appropriate.” (… I cant actually think of an example that matches your data. Probably tells you how often we use full outer joins)
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.