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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 真的很菜

linux目录结构 - 真的很菜 求助: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

但正确答案是

country numSunk Japan 2 USA 0

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

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