Q:

query confusion create query without create view

Here is the question 
we have 3 database variable(Person, event,invited)
Person(pid,passwd,fname,lname), 
Event(eid, start_time,duration,description,pid)
Invited(pid,eid,response,visibility)

I want to make a query witch will do 
show all people each event user X create. 
For example Person David create the event  with eid=  1 and 3. (2events)
and if Jany and Will invited to the eid =1 , and Mike invited to event 3
it should show 
EID PID
1   Jany
1   will
3   mike  

The part I confused is  Person and Event 's PID is a creater of the event 
and invited's PID is for person who invited. so its different PID value. 
so i can not just natural join them 
I can solve this problem with create view mysql command but I'm writing this code 
on PHP form so I want to finish this command in one command. 
what i tried is this 
select *
from invited
where  eid
in (SELECT eid
from person natural join event
where pid = 'DD')

But it does not give what I expected. 
How to write the code in One command without 'create view' command for this problem?

A:

Are you looking for this?
SELECT e.eid, i.pid, p.fname
  FROM event e JOIN invited i
    ON e.eid = i.eid JOIN person p
    ON i.pid = p.pid
 WHERE e.pid = ?

Sample output:

| EID | PID | FNAME |
|-----|-----|-------|
|   1 |   2 |  Jany |
|   1 |   3 |  Will |
|   3 |   4 |  Mike |

Here is SQLFiddle demo
Recommended reading

A Visual Explanation of SQL Joins

