由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 求助:找出现2次及以上的记录
相关主题
谁给我优化一下把重复的产品下架的SQLHow to insert a string into table? Thanks
求助:sql, count, group by, unionJDBC<======================>Oracle8i
请教:sql, 同时得出count_lastweek & count_allSpecial character in insert values
what is the difference between merge and update (oracle interview question)请教一个sql server的问题
问个Index的问题how to include record deleted date into trigger?
Problem when using SQL " Insert...." to AutoNumber.How to insert CURRENT TIMESTAMP into sql
MS T-SQL 问题一个JDBC的问题,希望大家指教!
SQL-Help![转载] Can anyone interpret this simple SQL?
相关话题的讨论汇总
话题: product话题: orange话题: production话题: insert
进入Database版参与讨论
1 (共1页)
n********6
发帖数: 1511
1
table:
transactionid, product
1 apple
2 orange
3 apple
4 pear
5 watermellon
6 orange
7 orange
output:
product, counter
apple 2
orange 3
谢谢。
B*****g
发帖数: 34098
2
you should be better than that!
http://www.w3schools.com/SQL/sql_having.asp

【在 n********6 的大作中提到】
: table:
: transactionid, product
: 1 apple
: 2 orange
: 3 apple
: 4 pear
: 5 watermellon
: 6 orange
: 7 orange
: output:

g***l
发帖数: 18555
3
GROUP BY having cout(*) >1不就行了,基础不扎实
n********6
发帖数: 1511
4
谢谢各位热情答复。
e*********y
发帖数: 29
5
没事做,给你完整的答案.呵呵! SQL Server 2005
create database neii
create table production
(
transactionid int primary key,
product char(25)
)
insert into production (transactionid, product) values ('1', 'apple')
insert into production (transactionid, product) values ('2', 'orange')
insert into production (transactionid, product) values ('3', 'apple')
insert into production (transactionid, product) values ('4', 'pear')
insert into production (transactionid, product) values ('5', 'watemellon')
insert into production (transactionid, product) values ('6', 'orange')
insert into production (transactionid, product) values ('7', 'orange')
select product,count(product) as counter from production group by product
having count(*)>1
1 (共1页)
进入Database版参与讨论
相关主题
[转载] Can anyone interpret this simple SQL?问个Index的问题
今典问题: 这个Self Query咋写?Problem when using SQL " Insert...." to AutoNumber.
Access门外汉问题求教MS T-SQL 问题
correlated subquerySQL-Help!
谁给我优化一下把重复的产品下架的SQLHow to insert a string into table? Thanks
求助:sql, count, group by, unionJDBC<======================>Oracle8i
请教:sql, 同时得出count_lastweek & count_allSpecial character in insert values
what is the difference between merge and update (oracle interview question)请教一个sql server的问题
相关话题的讨论汇总
话题: product话题: orange话题: production话题: insert