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

推荐订阅源

博客园_首页
I
InfoQ
The Register - Security
The Register - Security
L
LangChain Blog
H
Help Net Security
The GitHub Blog
The GitHub Blog
S
Schneier on Security
博客园 - 【当耐特】
W
WeLiveSecurity
Attack and Defense Labs
Attack and Defense Labs
IT之家
IT之家
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
H
Heimdal Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Y
Y Combinator Blog
雷峰网
雷峰网
N
Netflix TechBlog - Medium
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
Lohrmann on Cybersecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Exploit Database - CXSecurity.com
P
Privacy & Cybersecurity Law Blog
G
GRAHAM CLULEY
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
博客园 - 聂微东
PCI Perspectives
PCI Perspectives
Last Week in AI
Last Week in AI
A
Arctic Wolf
宝玉的分享
宝玉的分享
T
The Blog of Author Tim Ferriss
S
Secure Thoughts
T
Threat Research - Cisco Blogs
GbyAI
GbyAI
云风的 BLOG
云风的 BLOG
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
SecWiki News
SecWiki News
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
Schneier on Security
Schneier on Security
P
Proofpoint News Feed
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AI
AI
Engineering at Meta
Engineering at Meta

博客园 - 真的很菜

用户中心 - 博客园 求助: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天没结果