[Discuss] [OT RTFM]Quick SQL quesiton
Bill Horne
bill at horne.net
Sat Oct 5 09:43:53 EDT 2013
On 10/4/2013 12:25 PM, Tim Callaghan wrote:
> Bill, I'm happy to help but a little confused by the question. Can
> you provide the schema for this example?
OK, suppose I have three tables, constructed like so:
<key> | Name | Address | City | State | Zip | TN | Ext | Cell | -
call it the "People" table
<key> | <People key> | Meeting Description| Start Date | End Date |
- call this the "Meetings" table
<key> | <People key> | Evaluation Type | Date of evaluation | Reason for
evaluation | Result | - call this the "Evaluations" table
Now, I want to query *BOTH* the "Meetings" and "Evaluations" tables, and
get a result which shows every entry in the "People" table which matches
*EITHER* a meeting or an evaluation (or both), within a range of dates,
without any duplicates. In other words, I want a list of people who
attended a meeting or received an evaluation during the time period.
I hope that's more clear, but I'll be glad to provide additional info if
needed.
Bill
>
>
> On Wed, Sep 25, 2013 at 9:11 PM, Bill Horne <bill at horne.net
> <mailto:bill at horne.net>> wrote:
>
> I'll hijack the thread, a little, with a more generic SQL question:
>
> I want to merge two tables, and get all the unique results, i.e.,
> I want to take two tables with "key" values that look like
>
> 1 - 1 - 2 - 3 - 4 - 4 - 5 - 6
> 1 - 1 - 2 - 3 - 4 - 5 - 7 - 7
>
> and get a result of
>
> 1 - 2 - 3 - 4 - 5 - 6 - 7
>
> but, inner joins only produce matching records, and outer joins
> only give the compete set of records from one table or the other,
> not both.
>
--
Bill Horne
339-364-8487
More information about the Discuss
mailing list