ThinkPHP中查询语句怎么写

WBOY
Release: 2016-06-13 10:04:28
Original
800 people have browsed it

ThinkPHP中查询语句如何写?
类似于QQ的那种,一个用户信息表,用户有一些好友,我如何将用户的好友信息查询出来显示在页面.谢谢各位GGMM啦!

------解决方案--------------------

------解决方案--------------------
至少你应该给出相关的表结构
------解决方案--------------------
跟框架有什么关系呢

你设计相关的数据库,相应的搜索数据即可

你可以贴出用户表和好友表的结构
------解决方案--------------------
大概语句,,,假设需要useraccount ,,

SQL code
SELECT f.*, u.useraccount FROM usersfriend AS f LEFT JOIN [user表名] AS u ON f.frienduserid=u.useridWHERE f.userid=[要找的用户id]<br><font color="#e78608">------解决方案--------------------</font><br>tp的联合查询不会,我用tp也是直接 query(sql语句)<br><font color="#e78608">------解决方案--------------------</font><br>基本SQL:<br>select usersfriend.*<br>  from usersfriend, userinformation<br>  where usersfriend.frienduserid = userinformation.userid<br><br><font color="#e78608">------解决方案--------------------</font><br>路过,积点分<div class="clear">
                 
              
              
        
            </div>
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template