我有以下表格列:
posts: title, user, date, state, city, blog
user: username, name, password, email, city, state, private
我要做的是从posts.state = user.state和user.private =' public'的帖子中获取记录总数。我尝试了下面我知道错了,但我想我已经接近了。只是想弄清楚正确的语法。
$sqlposts = "select p.*, u.state, u.private
from posts p inner join user u on p.state = u.state
where u.private = 'public'";
我共保存了171条记录,此代码仅返回52条记录。
感谢任何帮助。感谢
答案 0 :(得分:0)
答案 1 :(得分:0)
这可能对您有所帮助
$sqlposts = "select p.*, u.state, u.private
from posts p left join user u on p.state = u.state