2013-06-13 42 views
-2

有2个表如下:Mysql的选择数据未显示

  1. 类别
  2. PC_Relation
 
Table Category:
ID Name
1 Blog
2 Roll
 
Table PC_Relation:
pc_catid pc_postid
1 35
1 33
2 33
2 36

我输入命令如下:

select * from PC_Relation where pc_postid = 36 

结果:

 
pc_catid pc_postid
2 36

但我想要的信息。

pc_catid = 1

我该怎么办?

+1

SELECT * FROM PC_Relation其中pc_catid = 1 – ankurtr

+0

我无法理解你的问题。什么是问题? –

+0

第三张桌子怎么样?这个有什么作用? – Roopendra

回答

1

如果您想休养pc_catid:

select pc_catid from PC_Relation where pc_postid = 36 

如果您想休养pc_catid = 1,其中:

select * from PC_Relation where pc_catid=1 
0

你试试这个?

select * from PC_Relation where pc_postid = 35 

你只想得到“1 35”的结果吗?还是“1 35”和“2 36”?

0

试试这个select * from PC_Relation where pc_catid = 1