I have a Mysql tables quote, users and followers. 

```
Quote(id,user_id,quote)
Users (id,username)
followers (follower,following_id)

```

What I want to do, is to fetch all quotes, the question is about how to sort the quotes, in a way that **quotes by users I'm following are the first**, then the ones **by users who are following me**, then **quotes by other users**.

This is my sql query:

```
$sql='Select
    id,
    quote
FROM 
   quote
WHERE
    quote like '.$pdo->quote('%'.$item.'%');

```

I mean, if you're using facebook, and you started a research for your friends, you'll see that people whom you're friends with are the first to display, then the ones you may know, then the ones you may have spoken with..etc.

I find a trouble building the query after ORDER BY. Also I looked for this in the web, But I didn't find it, I think I'm not using right keywords for this issue.

Thanks in advance.