►
From YouTube: TTEOT Training Video - S1E10 - SQL: Unions
Description
In order to form a more perfect union... you need to watch this video! We'll go over how to show the results of multiple queries in a single report.
Music: https://www.bensound.com
A
All
right,
hello,
everybody,
I'm
george
williams,
I'm
from
the
northeast
kansas
library
system
in
lawrence.
B
A
And
today
this
is
another
thrilling
episode
of
every
other
thursday
coho
videos
and
we're
going
to
be
talking
about
some
more
sql
stuff
and
right
now,
I'm
at
the
coho
us
site,
which
is
at
coho
dash
us.org,
and
you
can
find
what
we've
done
already.
If
you
go
to
the
link
that
says,
learn
from
quahog
us
and
then
there's
the
link
here
that
says
you
kaha
us
videos,
there's
a
whole
list
of
these
videos.
A
Here,
the
last
few
weeks
we've
been
doing
a
lot
of
sql.
A
You
can
also
find
us
on
youtube
and
if
you
click
on
playlists,
there's
there's
the
terrific
every
other
thursday
training
videos
there's
the
whole
list
right
there,
and
today
we're
going
to
be
talking
about
some
more
sql
and
this
shouldn't
be
a
terribly
long
video.
A
Famous
last
words,
I
think
we
can
keep
this
under
two
hours.
Oh
okay,
what
do
you
have
to
be
on
the
desk.
A
25
minutes
we
can
be
done
at
25
minutes,
okay,
so
so
we've
talked
about
a
lot
of
things
so
far
things
tricks
to
do
in
in
in
my
sequel
and
one
of
the
things
that
that
is
in
a
bigger
report
that
a
lot
of
these
things
are
leading
up
to
is
a
union
query,
and
so
that's.
A
That's
doing
pretty
much
just
one
thing:
I'm
getting
all
of
the
data
out
of
the
reserves
table.
Okay-
and
I
do
have
one
weird
little
thing
here:
I've
got
an
if
then
statement.
A
If
reserves
id
is
not
null,
then
I'm
going
to
call
this
active
and
if
reserve's
id
is
null
I'm
going
to
put
a
dash
there.
This.
A
A
A
So
there
are
some
times
when
something
you're
looking
for
might
be.
You
might
want
to
be
searching
for
it
in
reserves
or
you
might
want
to
be
searching
for
it
in
old
reserves.
A
Yeah
and
so
what
we
can
do,
instead
of
having
to
run
a
query
to
search
old
reserves
and
then
running
a
separate
query
to
run
search
reserves,
we
can
combine
them
and
that's
what
this
third
query
does
is
we
can
combine
all
of
this
stuff
from
reserves
and
all
of
this
stuff
from
old
reserves
into
one
table
into
one
set
of
results.
A
So
in
this
first
one
we've
got
fourteen
thousand
three
hundred
and
thirty
results
and
then
the
second
one
we've
got
two
hundred
and
twenty
two
thousand
sixty
five
results,
and
in
this
one
we've
got
all
of
those
results
together
in
one
big
in
one
place
now
in
and
of
itself,
let
me
show
you
how
we
do
this
in
and
of
itself.
That's
not
helpful,
but
if
we
were
doing
like
a
sub
query,
if
we
we
could
use
this
data
as
a
sub
query
and
another
query
to
to
get
things
out
of
this
table.
B
B
The
thing
that
I
ran
into
before
my
an
incorrect
understanding
or
belief
was
that
you
had
to
have
the
same
types
of
columns,
but
no
it's
just.
The
number
is
the
the
key
yeah.
A
Yeah
you
can,
we
could
do
all
these
backwards,
it
would
make
it
completely
useless.
It
would
ruin
the.
A
A
Sql
doesn't
know
how
to
output
that
kind
of
data,
but
so
now
I've
got
a
report
that
essentially,
what
I've
got
is
a
gigantic
list
of
every
reserve,
every
request,
that
is
in
the
system,
whether
it's
just
been
placed
or
whether
it's
already
been
filled
or
it's
been
canceled
or
it's
expired,
any
any
situation
where
that
reserve.
That
request
is
still
in
the
database.
A
A
I
can't
think
of
a
good
thing
I
could
do
with
that
on
its
own,
but
what
I
can
do,
let's
see
that
one
was
number
three,
so
the
next
one
would
be
number
four.
A
B
A
I've
turned
it
into
a
sub
query
in
this
other
in
this
other.
In
this
other
query
and.
A
The
data
that
I
want
from
the
from
the
old
reserves
and
old
reserves,
but
I've
also
got
you
know
the
card
number,
the
patron
that
placed
it
because
I've
linked
the
borrower
number
in
reserves
and
old
reserves
out
to
the
out
to
the
patron
data
so
that
I
can
get
the
the
card
number.
A
So
first
I
wrote
the
query
to
get
the
reserves
data
and
then
I
thought
about
it.
I
said
I'm
also
going
to
want
the
data
from
old
reserves.
So
then
I
wrote
a
query
to
get
old
reserves
and
I
linked
them
together
and
then
I
thought
of
the
other
things
that
I
would
need,
and
then
I
added
some
refinements.
B
A
Then
I
added
a
drop
down,
so
I
could
say
show
me
just
the
things
for
this
specific
pickup
library
and
then
I
created
a
drop
down
for
do.
I
want
all
the
requests
or
just
the
ones
that
have
been
filled,
and
then
I
could
even
enter
a
specific
barcode
number
for
an
item.
A
Because
I
have
this
question,
come
up
from
libraries
is
you
know
this
patron
wants
to
know?
You
know
I
want
to
know
about
this
request
that
a
patron
placed
what's
the
information
about
it.
So
this
way
I
can
use
this
report
to
say
you
know
the
request
was
placed
on
this
date.
It
expired
on
this
date,
there's
a
time
stamp
for
when
the
last
time
it
was
modified
and
here's
all
the
item
information.
A
This
is
actually
modified
from
what
I
from
what
I
actually
have
in
our
system.
This
is
just
a
sample
report,
but
the
the
actual
report
on
our
system
tells
you
who
the
patron
is
too
so
that
you
can
go
directly
to
that
patrons
account.
A
A
A
L
hold
act
so
that
I
could
get
that
active
cancelled
in
progress
all
of
those
different
things
in
that
drop
down
all
right.
But
that's.
A
You
can
use
a
union
query.
I've
got
another
example
here
that
I
won't
walk
through
the
steps
of
how
I
created
it.
But
let
me
just
run
this
one.
This
one
is
called
top
200
cirques
in
the
previous
year,
and
so
let's
just
pick
a
let's
pick
a
branch,
that's
going
to
have
a
decent
amount
of
circulation
and
let's
just
do
books,
leavenworth
books,
nonfiction,.
A
A
And
let
me
show
you
the
code
for
this,
so
the
union-
that's
in
here
is
the
same
thing.
I
needed
to
get
data
from
issues
and
from
old
issues,
and
so
I've
got
issues
and
old
issues
are
joined
here
and
that
creates
essentially
a
big
list
of
all
the
issues,
all
the
checkouts
and
then
the
rest
of
this
data.
B
I
find
those
unions
are
great
between
the
issues
and
the
reserves,
but
also
with
borrow
borrowers,
and
you
might
want
information
that
happens
that
happen
in
a
specific
time
period,
but
some
of
those
borrowers
or
items
or
issues
or
reserves.
Some
of
those
may
have
resolved
and
moved
to
another
table,
and
you
know
that's
where
it's
like
you're
getting
incomplete
information,
if
you're
not
using
union
to
to
combine
those
tables
to
get
a
complete
picture.
B
A
When
I
I
had.
A
This
specific,
you
know
top
200
circuits
in
the
last
year
report
is,
there
is
one
it
seems
like
there's
a
high
circ
report
built
into
quahog,
but
the
one
my
one
of
my
predecessors
at
this
job
had
created
a
report
that
was
looking
at
topserks,
but
it
was
only
looking
at
old
issues.
B
A
Something
was
checked
out
right
now.
You
wouldn't
get
any
data
from
that
and
the
I
have
another
version
of
this
report
that
lets
you
look
at
a
date
range.
So
what
were
the
top
circuits
between
day,
day
and
date
b?
A
This
one
I
just
created
as
a
way
of
looking
at
the
at
the
top
2006
in
the
last
year,
but
that
was
one
of
the
that
was
a
shortcoming
in
the
report
that
existed
when
I
got
to
this
job
is
that
it
was
only
looking
at
old
issues,
but
by
adding
this
union
here,
then
things
that
are
still
checked
out
are
counted
as
those
top
circuits.
B
A
So
so
that's
how
to
do
a
union.
You
know,
I
don't
think.
A
B
Yeah-
and
I
was
showing
you
this
this
earlier-
let
me
get
this
on
here.
B
So
I've
been
I've
been
playing
with
a
union
as
well.
Do
you
see
my
coha?
Yes,
okay,
so
I've
been
playing
with
the
actually.
B
Okay,
so
I've
been
playing
with
this
this
report
recently
and
this
is
using
a
union
but
in
a
a
little
bit
different
way-
and
this
may
be
a
report
that
I
can
I
can
share
on
more
down
the
road,
but
this
particular
one
combines
several
results
that
I
had
in
individual
reports
earlier
and
so
I'm
making
use
of
cases
and
I'm
making
uses
of
coalesce,
which
you
educated
me
in
on
the
last
video,
so
really
making
use
of
that.
B
But
one
of
the
things
that
you
can
do
with
union
is
as
long
as
you
have
the
same
amount
of
columns,
you
can
put
information
into
a
report
that
has
nothing
to
do
with
the
the
previous
information,
so
you
can
have
results
of
two
different
reports
in
the
same
report.
They
have
nothing
to
do
with
each
other,
they're,
not
referencing,
the
same
information,
but
you
know,
as
long
as
you
have
the
same
amount
of
columns,
you
can
still
produce
that
information.
So
what
I've
done
here
is.
B
I
have
another
report
down
lower
that
is
totally
unrelated
to
the
information
above,
but
you
know
the
the
headings
up
above,
don't
match
what
I'm
reporting
down
here
below,
so
I've
I've
added
a
a
union
that
is
just
a
select
that
that
you
know
adds
some
lines
to
show.
This
is
something
different
and
then
I've
added
another
select.
That
is
just
some
static
information.
These
are
my.
B
B
This
last
month
that
I
did
here
it'll
take
a
minute
because
it
is
right,
it
is
pulling
a
lot
of
information,
but
the
nice
thing
is,
it
saves
me
so
much
time
having
to
run
a
report
enter
all
the
information,
run,
a
report
and
enter
all
the
information.
I
can
just
do
it
once,
which
is
really
nice
and
it'll
feed
back
all
of
this
information
that
I
need.
B
I
might
not
I'm
not
going
to
necessarily
put
everything
into
one
report,
because
I
don't
want
to
drag
the
system
down,
but
you
know
this.
This
will
give
me
a
good
chunk
of
it,
and
so
the
top
half
of
this
report
is
giving
me
back
results
but
based
on
library,
collection
and
the
type
of
information
that
it's
getting.
This
is
from.
B
I
believe
I
can't
remember
if
it's
from
the
stats
or
from
or
another
table
but
anyways,
it's
pulling
this
information
and
parsing
it
out
into
categories
that
I've
chosen.
But
then
here
are
my
dashes
down
below
it's
a
separator
for
breaking
off
into
something
else
and
here's
my
my
mocked,
headers
and
then
completely
different
information.
B
How
many
checkouts
were
done
by
coeur,
d'alene
staff
and
I'm
going
to
add
self
checks,
and-
and
things
like
that,
so
so
this
is
a
good
representation
of
how
you
can
use
union
in
other
ways
other
than
combining
like
tables.
B
B
I
I
come
across
coalesce
once
or
twice,
but
I
had
never
thought
of
it
and
and
used
it
in
the
way
that
you
presented
and
it
was
like
it
really
opened
up
possibilities.
For
my
my
report.
Writing
you
know
I
I
feel
like
I
do
a
pretty
decent
job
with
reports,
but
this
gave
me
more
ammo
that
that
really
made
a
huge
difference.
B
A
B
A
The
next
thing-
and
I
think
it'll
be
the
last
thing
that
goes
into
that
people
ought
to
know
before
they
do
that
before
I
show
off.
That
report
is
how
to
query
the
data
directly
from
the
mark,
the
x
mark
extraction.
So
that
actually
is
pretty
simple.
That's
something
I
learned
from
you.
A
A
Yes
back
when
the
mark
data
was
in
biblio
items
instead
of
in
biblio
metadata
yeah.
So
so
the
data
is
still
there.
It's
just
in
a
different
table
than
it
was
ten
years
ago,
but
you
wanted
to
you
had
issues
with
the
report
for
the
holds
queue
not
showing
the
245b
or
the
245p.
A
B
Nice,
well,
I
love
it.
I
love
it
when
I
can
contribute
and
help
those
that
helped
me
and
you
you.
I
know
that
we've
collaborated
many
times
on
reports.
You've
done
a
tremendous
amount
of
work
that
I've
built
off
of
and
I'm
glad
to
see
that
some
of
my
work
is
coming
back
to
you.
So,
okay
awesome
all
right
well
until
next
time
next
time.
Thank
you
very
much.
We'll
see.
Y'all.