sql 查询问题 在线等 谢谢啦~
--作品,会员以及文章评论表
if exists (select * from sysobjects where [name] = 'tb_pinglun' and type='U')
drop table tb_pinglun
create table tb_pinglun
(
plid int identity(1,1) not null primary key, --投票编号
pladdtime smalldatetime default(getdate()), --投票日期
plcontent varchar(800), --简短评论
plip varchar(15), --投票ip地址
plzpid int default(0), --投票作品编号(作品,会员或文章id)
pltusid int default(0), --被评论会员id
plfusid int default(0), --发表评论会员id(0为游客评论)
pltypid smallint default(0) --评论类型(1作品评论,2会员评论,3文章评论,4个人心情)
)
--用户表
if exists (select * from sysobjects where [name] = 'tb_users' and type='U')
drop table tb_users
create table tb_users
(
usid int identity(1,1) not null, --用户编号
uslinse varchar(20) not null primary key, --用户编号
usname varchar(50) --用户名
)
上面是我的表结构,现在的问题是这个评论的管理后台,需要同时现在2个用户的名字,即pltusid,plfusid。
这2个字段需要关联tb_user表,怎样一句sql能同时把pltusid,plfusid。对应的用户名都查出来并且显示出来呢
不知道说明白没有~ 谢谢啦