I need a way to order a list of rows and place the user's Facebook friends first.

Is there any way I can do it? Which approach should I follow?

I have never worked with Facebook Connect, so this is just a hypothetic question, because I'll be working with it soon.

Should I just get the Facebook friend list EVERY time a user search (and the list will be generated). Then in my table, I'll save every user's facebook\_uid?

But how will I order it so Facebook friends is first, and "strangers" will be shown afterwards?

My table could for example look like this:

```
id - facebook_uid - text
1  - 1111111      - lorem ipsum.....
2  - 2222222      - something else....
3  - 3333333      - third!!!

```

So if for example 1111111 and 3333333 are friends of mine, the returned ID's would be (in the right order): 1,3,2.

How do I order that in SQL (or PHP logic)?