0
我有一些問題。如何使用另一個選擇命令選擇結果? (mysql,php)
這是我的示例表。
create table Board (
readLevel tinyint not null,
writeLevel tinyint not null,
PRIMARY KEY (boardID)) engine=InnoDB character set=utf8;
create table Post (
postID int not null AUTO_INCREMENT,
title char(50) not null,
content TEXT not null,
writeDate date not null,
readCount int not null,
PRIMARY KEY (postID)) engine=InnoDB character set=utf8;
create table Save_Board_Post(
boardID char(30) not null,
postID int not null,
FOREIGN KEY (boardID) REFERENCES Board(boardID) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (postID) REFERENCES Post(postID) ON DELETE CASCADE ON UPDATE CASCADE) engine=InnoDB character set=utf8;
第一張桌子很簡單,第二張是Post。
第三是董事會和郵政之間的關係表。
我想通過'Save_Board_Post'的SELECT結果在Post表中使用SELECT命令。
如
select postID from Save_Board_Post where boardID= 'testBoard';
在這種情況下,在控制檯輸出結果是...
帖子ID
,我想用這個結果爲下一次選擇。
select * from Post where (SELECT Result);
如何把它們?
我已經使用這句話。
select * from Post where "select postID from Save_Board_Post where boardID= 'testBoard' ";
但在控制檯中沒有結果。
請讓我知道。謝謝!
哦,怎麼,你是非常快的!感謝您的回答!非常感謝你! – Pororoca
我猜的條件句是必須在引號中,而不是在括號中。再次感謝! – Pororoca
@Pororoca你總是可以選擇我的答案作爲正確的答謝我。 )。 –