开发者

Sqlite sql statement with join, on, and where

开发者 https://www.devze.com 2023-03-08 11:35 出处:网络
I have 2 tables: refs and content I want to select rows from refs where one column named bi=0. Then I want to join the refs table and content table when refs.topi开发者_开发问答c_id = content.topic_

I have 2 tables: refs and content

I want to select rows from refs where one column named bi=0.

Then I want to join the refs table and content table when refs.topi开发者_开发问答c_id = content.topic_id

Below is what I tried but is an error because of a join, where, and on statement all together.

SELECT refs.topic_id,bi,ci,fvi,tvi
FROM refs
WHERE bi= “0”
JOIN content 
ON refs.topic_id = content.topic_id
ORDER BY bi;


SELECT refs.topic_id,bi,ci,fvi,tvi
FROM refs
JOIN content 
ON refs.topic_id = content.topic_id
WHERE bi= “0”
ORDER BY bi;


The join clause must follow directly the from clause.

0

精彩评论

暂无评论...
验证码 换一张
取 消