Sql 多表查询
我使用 SQL 2000 和数据库有以下表格
LandParcel (Table Name) BlockID ParcelNo NameofOnwe 11001 1056 Chandana 11001 1078 Sisil 11001 1158 Kumara 11078 105 SK 11078 245 Shantha
Actions (Table) Blockid ParcelNo ActionTaken 11001 1056 Received 11001 1078 Received 11001 1158 Received 11078 105 Received 11078 245 Received 11001 1056 Send To LR 11001 1078 Send to LR 11078 105 Send To LT
我想要以下查询
Blockid ActionTaken ParcelNos 11001 Received 1056, 1078, 1158 11078 Received 105, 245 11001 Send To LR 1056, 1078 11078 Send To LR 105
请帮助我 旃陀那
I Used SQL 2000 and database have following tables
LandParcel (Table Name) BlockID ParcelNo NameofOnwe 11001 1056 Chandana 11001 1078 Sisil 11001 1158 Kumara 11078 105 SK 11078 245 Shantha
Actions (Table) Blockid ParcelNo ActionTaken 11001 1056 Received 11001 1078 Received 11001 1158 Received 11078 105 Received 11078 245 Received 11001 1056 Send To LR 11001 1078 Send to LR 11078 105 Send To LT
I want the following query
Blockid ActionTaken ParcelNos 11001 Received 1056, 1078, 1158 11078 Received 105, 245 11001 Send To LR 1056, 1078 11078 Send To LR 105
Pl help me
Chandana
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太喜欢光标,但我找不到其他解决方案。我稍后可能会尝试在没有光标的情况下执行此操作。
I don't like cursors much but I cold not find other solution. I might try later doing this without cursors.
您可以使用 SQL Server 2000 中的
FOR XML RAW
来模拟 SQL Server 2005 的FOR XML PATH
行为:You can use
FOR XML RAW
from SQL Server 2000 to simulate theFOR XML PATH
behavior of SQL Server 2005: