select username,nicname from appaccount where
id in
(select otherid from friends where localid=(
select id from appaccount where username=#username# )
) or id in
(select localid from friends where otherid=(
select id from appaccount where username=#username# )
)
上述语句已经通过输入的账号名查到了其好友的账号和昵称的列表,现在要求按照friends表中的id进行排序 我又不会来……
id in
(select otherid from friends where localid=(
select id from appaccount where username=#username# )
) or id in
(select localid from friends where otherid=(
select id from appaccount where username=#username# )
)
上述语句已经通过输入的账号名查到了其好友的账号和昵称的列表,现在要求按照friends表中的id进行排序 我又不会来……
解决方案 »
- 执行function时报错(subtransactions in a transaction)
- MYSQL怎么样能读取.ibd文件中的数据啊?谢谢
- mysql-5.0.92.zip 里面找不到setup.exe
- 求助:mysql convert
- 用于统计的SQL语句求解
- mysql问题
- MySQL中存储中文用utf8还是gb2312? longtext是最长的字符类型吗,和varchar比呢?
- 关于postgresql中的dblink.sql
- mysql两表关联查询并统计问题
- MySQL 从一张表update字段到另外一张表中,两张表均是千万数据量
- 关于mysql源码版本选择问题,以及源码学习的方法
- myodbc5S 与 myodbc5W的区别是什么
给一个账号username 查处他的所有好友列表 并按照friends的id排序
那我应该怎么查呢 账号表appaccount(id username nicname) 好友表friends(id locaoid otherid)
给一个账号username 查处他的所有好友列表 并按照friends的id排序
from appaccount a inner join friends f on a.id=b.locaoid
inner join appaccount b on f.otherid=b.id
where a.username='他'
order by b.id
我的localid和otherid一样 俩人只有一条好友关系