我写的两个查询语句,只能查询2个数据库的2张表use QPTreasureDB
select top 5 b.Accounts,a.*
from RecordPurchaseProp
as a inner join QPGameUserDB..AccountsInfo
as b on a.SendUserid = b.Userid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )
and a.SendUserID=1799
go现在需要在QPTreasureDB库下的C表和A表联合查询
我是这么写的 use QPTreasureDB
select top 5 b.Accounts,a.* ,c.catename
from RecordPurchaseProp,GameShopCate
as a inner join QPGameUserDB..AccountsInfo
as b on a.SendUserid = b.Userid
as a.cateid=c.cateid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )
and a.SendUserID=1799但是这么些总是报错
求答案最好能写出完整的
select top 5 b.Accounts,a.*
from RecordPurchaseProp
as a inner join QPGameUserDB..AccountsInfo
as b on a.SendUserid = b.Userid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )
and a.SendUserID=1799
go现在需要在QPTreasureDB库下的C表和A表联合查询
我是这么写的 use QPTreasureDB
select top 5 b.Accounts,a.* ,c.catename
from RecordPurchaseProp,GameShopCate
as a inner join QPGameUserDB..AccountsInfo
as b on a.SendUserid = b.Userid
as a.cateid=c.cateid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )
and a.SendUserID=1799但是这么些总是报错
求答案最好能写出完整的
select top 5 b.Accounts,a.* ,c.catename
from RecordPurchaseProp,GameShopCate
as a inner join QPGameUserDB..AccountsInfo
as b on a.SendUserid = b.Userid
as c on a.cateid=c.cateid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )and a.SendUserID=1799
go这个就别纠结了
from RecordPurchaseProp,GameShopCate
as a inner join QPGameUserDB..AccountsInfo
as b on a.SendUserid = b.Userid
and a.cateid=c.cateid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )
and a.SendUserID=1799
go
select top 5 b.Accounts,a.* ,c.catename
from RecordPurchaseProp c,
GameShopCate as a
, QPGameUserDB..AccountsInfo as b
where a.SendUserid = b.Userid
and a.cateid=c.cateid
and a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )
and a.SendUserID=1799
and c on a.cateid=c.cateid
from RecordPurchaseProp
as a inner join GameShopCate
on a.SendUserid = b.Userid
inner join QPGameUserDB..AccountsInfo
as c on a.cateid=c.cateid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )and a.SendUserID=1799
from RecordPurchaseProp
as a inner join GameShopCate
as b on a.SendUserid = b.Userid
inner join QPGameUserDB..AccountsInfo
as c on a.cateid=c.cateid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )and a.SendUserID=1799
select top 5 b.Accounts,a.* ,c.catename
from RecordPurchaseProp a join GameShopCate b on a.cateid=b.cateid
join QPGameUserDB..AccountsInfo c on a.SendUserid = c.Userid
WHERE a.SendUserID=1799 and RecordID not in (select top 0 RecordID from RecordPurchaseProp )
and a.SendUserID=1799
a和C是同一个数据库下的 B是另外一个数据库的
以上的都报错