按另一个表列排序表?

I have this query:

$q = "SELECT * FROM user 
WHERE sec='1' AND reg_by='".$_SESSION['login_username']."' 
ORDER BY date DESC LIMIT $startrow, 30 ";

I have another table which stores appointments, it has a column named meet.

How can I sort this query by meet?

Not all data at users are in other table.

You can use the below query. Replace another_table with your original table name :

$q = "SELECT u.* FROM user AS u LEFT JOIN another_table AS at ON u.userid = at.userid WHERE u.sec='1' AND u.reg_by='".$_SESSION['login_username']."' ORDER BY at.meet DESC LIMIT $startrow, 30 ";

you can use joining for this like

select user.*,meet.* from user left join meet on (meet.userid = user.id) where user.sec='1' AND user.reg_by='".$_SESSION['login_username']."' order by meet.userid DESC
$q = "SELECT * FROM user INNER JOIN user
ON meets.userid=user.userid WHERE sec='1' AND reg_by='".$_SESSION['login_username']."'  ORDER BY date DESC LIMIT $startrow, 30 ";