这条select语句怎么改才能实现查询目的?

来源:百度知道 编辑:UC知道 时间:2024/06/08 13:14:59
有三个表:顾客下订单信息表xinxi 商品表cp_aboutus 会员表huiyuan
我要查询:某一会员发布的商品的订单信息。其中订单信息表中的zixuan字段的值=商品表中的自动编号字段articleid相同。我用下面的语句查询的话,查询结果是没有一条信息。显然有错误。
select * from xinxi where zixuan = 'select articleid from cp_aboutus where cp_aboutus.username=huiyuan.username'
我把语句改为如下,即zixuan字段的值直接等于商品的articleid,就会输出正确的信息。
select * from xinxi where zixuan = '774'。
第一句怎么修改才能出现出结果呢?希望各位高手指教,谢谢。
'select articleid from cp_aboutus where cp_aboutus.username=huiyuan.username'这条语句中articleid是自动编号 ,值是一个自动编号列表。
huiyuan.username 有值,意思是会员表中用户名username字段

补充问题:这条语句:select * from xinxi where zixuan = 'select articleid from cp_aboutus where cp_aboutus.username=huiyuan.username'改为:select * from xinxi where zixuan ='select cp_aboutus.articleid from cp_aboutus ,huiyuan where cp_aboutus.username=huiyuan.username'后'select cp_aboutus.articleid from cp_aboutus ,huiyuan where cp_aboutus.username=huiyuan.username'有值,它的值是一个列表,里面有好多值,如:775 7

'select articleid from cp_aboutus where cp_aboutus.username=huiyuan.username'
这个的值是什么?

select * from xinxi as A,cp_aboutus as B where A.zixuan='B.articleid' and A.username=B.username 试试行不行

select articleid from cp_aboutus where cp_aboutus.username=huiyuan.username
这里 huiyuan.username 有值?