惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
量子位
A
Arctic Wolf
L
Lohrmann on Cybersecurity
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
V
Vulnerabilities – Threatpost
博客园 - Franky
C
Cyber Attacks, Cyber Crime and Cyber Security
The Cloudflare Blog
Last Week in AI
Last Week in AI
The Hacker News
The Hacker News
I
Intezer
J
Java Code Geeks
P
Privacy International News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Secure Thoughts
Cisco Talos Blog
Cisco Talos Blog
阮一峰的网络日志
阮一峰的网络日志
S
Securelist
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Jina AI
Jina AI
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
博客园_首页
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Exploit Database - CXSecurity.com
雷峰网
雷峰网
T
Tenable Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy & Cybersecurity Law Blog
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - 【当耐特】
T
Threat Research - Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
N
News | PayPal Newsroom
Google Online Security Blog
Google Online Security Blog
K
Kaspersky official blog
H
Help Net Security
宝玉的分享
宝玉的分享
罗磊的独立博客
Webroot Blog
Webroot Blog
月光博客
月光博客
B
Blog RSS Feed
Recorded Future
Recorded Future

博客园 - 真的很菜

用户中心 - 博客园 求助:DataGrid加行号的问题 C++Builder 2007 一个JS的问题,请帮下忙! 对谷歌输入发的一点疑虑 开始练习VS2003了 VC++.NET编译的问题 SQL查询结果的合并问题 Visual studio 2005 sdk 安装引起的后果 几个微软的好东西! Visual studio 已安装模版错误怎么解决? 想学ASP建站,有几个问题,请帮忙解决,谢谢! Win2003 IIS配置asp的问题 不要轻易删除/windows/install下文件 xp下安装sqlserver2000提示有挂起 Daemon Tools手工完全卸载方案 [转]将visual studio 2005 SP1补丁整合到安装文件 转:FTP命令全集(收藏) TurboTweaks-解除Turbo Explorer限制
SQL 查询,请帮忙
真的很菜 · 2007-03-11 · via 博客园 - 真的很菜

csdn老系统错误,虽然cnblogs不关心T-SQL,但我想这里一定有人懂

两个表

Table: Ships

name yearLaunched country numGuns gunSize displacement
Bismarck 1940 Germany 8 15 42000
Oktyabrskaya Revolutsia 1914 USSR 12 12 23000
Warspite 1915 Great Britain 8 15 31000
Hood 1920 Great Britain 8 15 41000
Nelson 1927 Great Britain 9 16 34000
Prince of Wales 1941 Great Britain 10 14 38000
Giulio Cesare 1914 Italy 10 13 24000
Texas 1914 USA 10 14 27000
Arizona 1916 USA 12 14 33000
California 1921 USA 12 14 32000
West Virginia 1923 USA 8 16 32000
New Jersey 1943 USA 9 16 46000
Missouri 1944 USA 9 16 46000
Kirishima 1915 Japan 8 14 32000
Fuso 1915 Japan 12 14 35000
Yamashiro 1917 Japan 12 14 35000
Nagato 1920 Japan 8 16 38000
Yamato 1941 Japan 9 18 65000
Musashi 1942 Japan 9 18 65000

Table: Battles

ship battleName result
Fuso Surigao Strait sunk
Yamashiro Surigao Strait sunk
California Surigao Strait ok
West Virginia Surigao Strait ok
Bismarck North Atlantic sunk
Hood North Atlantic sunk
Prince of Wales North Atlantic damaged

其中ships.name=battles,ship
我用
select distinct ships.country ,Battles.battleName,ships.country from ships  right join Battles on ships.name=Battles.ship
查出下面结果

country battleName country
Japan Surigao Strait Japan
USA Surigao Strait USA
Germany North Atlantic Germany
Great Britain North Atlantic Great Britain

正确答案是

country country
Japan USA
Germany Great Britain

请问怎么查?(就是查具有同一battleName的country)

还有
我用
select country,count(*)as numsunk
from ships join Battles on ships.name=Battles.ship
where battleName='Surigao Strait'
and result='sunk'
group by country

查出

但正确答案是

country numSunk
Japan 2
USA 0

我的把USA搞没了
怎么解决谢谢

虽然不干.NET事,请不要怪,百度了N天没结果