And this is what it's going to look like.
So you are going to add a table.
It does not matter if you change the query
at the top or the bottom first.
But you can notice up here, we had ZVIBERMESSAGE.ZTEXT.
That was already there.
ZATTACHMENT is new.
So we're saying, ZATTACHMENT.ZNAME, show us
that attachment file name.
All the other stuff, we've already done.
But the main difference here, we have FROM ZVIBERMESSAGE,
but then we have to do these joins.
And I'm going to explain these joints to you in a moment.
We say, LEFT JOIN that table when that table and that column
equals that table and that column.
Most people do the bottom part or the top part and not both,
and they don't get anything.
Look at the query results now.
We actually have an attachment file name.
So I'm going to show you this.
We're in here, and I want the name of the person who sent it.
So we have game IDs and user IDs.
Let's look at user_id first.
So if I go out to Browse Data, and I go to users,
I have something called pk, user_id, email_address,
name, created.
So what I have to find is what is in common.
It looks like user_id and user_id may be the thing that's
actually the same.
So I'm going to try that.
What I'm going to do is go back into my execute query,
and I am going to say, up top, users.name.
Let's try that, users.name, no comma.
Now, if I press error or Enter, it doesn't know.
It's like, I don't know that column because I
didn't join the table.
So it can't do anything with that.
So what I have to do is below here, no punctuation,
I'm going to say left join--
and I'll explain what that means in a moment--
users on users.user_id ID equals chat_messages.user_id.
Let's see if this works.
And this could be a game of playing,
like, oh, I don't know if it worked.
This did work.
So we can see Hmahalik.
We see some other names of interest in here.
Now that you've done that, what I recommend you doing
is getting rid of what you don't need.
So that user_id, we actually have a name now.
If you want to keep it there, you can.
But if it's unnecessary, then you can get rid of it.