求一视图,详细请进 select no from 表 group by no having count(*)=1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 或:select no from 表 group by no having sum(1)=1 再问一句having count(*) = 1跟having count(no) = 1有什么区别? select nofrom tablegroup by nohaving count(bh) =1 select nofrom tablegroup by nohaving count(no) =1 为什么select * 的时候会出错?怎样同时选出其他字段?我不想只要这一个字段,这样没有意义啊。 select no from 表 group by no having count(*)=1or select * from 表 aa where (select count(*) from 表 where aa.no=表.no)=1 create table f_newinsurance ( sign_date date, #签单日期 sign_date_id integer, #签单日期ID customer_id integer not null , #客户ID gr_tt_indicator char(4), #个人团体标志 policy_id integer not null , #保单ID policyno varchar(20), #保单号 start_date date, #起保日期 end_date date, #止保日期 sht_indicator char(6), #短期险标志 indorno char(20), #批单号 indor_id integer, #批单ID character_id integer, #特性ID vehtype_id integer, #车型ID insno_id integer not null , #险种ID maker_id integer not null , #经办人ID agent_id integer, #代理点ID busitype_id integer not null , #展业方式ID driver1_id integer, #第一驾驶员ID driver2_id integer, #第二驾驶员ID vehicle_id integer, #车辆信息ID new_indicator char(4), #新保续保标志 newprice_ind char(10), #新车购置价分段 veh_age smallint, #车龄 doctype_id integer not null , #单证类型 thd_ins_id integer, #三者限额ID risk_indicator char(10) not null , #高风险标志 thd_indicator char(10), #单保三者标志 busi_num integer not null , #业务笔数 insu_num integer not null , #承保数量 policy_sum decimal(16,2) not null , #保单保额(主险保额之和) insu_sum decimal(16,2) not null , #保险金额(单险种保额) deposit decimal(16,2) not null , #储金 premium decimal(16,2) not null , #保险费 return_prem decimal(16,2) not null , #安返退费 time_stamp datetime year to second not null , #时间戳 cx_flag char(1) #车险标志 );表是这样的,选择依据policyno那一列。 select * from 表 where no in (select no from 表 group by no having sum(1)=1) 关于插入数据时另外一个表的更新 如何用命令修改PK的索引类型? 如何查看一个新数据库中有多少张表和表名 新手SQL2005关于代码输入的问题 如何对nvarchar类型的1,10,4按序排序? 请教sql问题 这样的sql如何实现 如何用sql将binary字段转换为字符串显示 max函数的猫腻??? SQL数据库太大。导致应用系统越来越慢。 记录条数存在什么地方,我怎样才能求得呢?请赐教!!! 最好40分了,在CB版没有人回答,求高人了,帮忙
select no from 表 group by no having sum(1)=1
跟
having count(no) = 1有什么区别?
select no
from table
group by no
having count(bh) =1
from table
group by no
having count(no) =1
怎样同时选出其他字段?
我不想只要这一个字段,这样没有意义啊。
(
sign_date date, #签单日期
sign_date_id integer, #签单日期ID
customer_id integer not null , #客户ID
gr_tt_indicator char(4), #个人团体标志
policy_id integer not null , #保单ID
policyno varchar(20), #保单号
start_date date, #起保日期
end_date date, #止保日期
sht_indicator char(6), #短期险标志
indorno char(20), #批单号
indor_id integer, #批单ID
character_id integer, #特性ID
vehtype_id integer, #车型ID
insno_id integer not null , #险种ID
maker_id integer not null , #经办人ID
agent_id integer, #代理点ID
busitype_id integer not null , #展业方式ID
driver1_id integer, #第一驾驶员ID
driver2_id integer, #第二驾驶员ID
vehicle_id integer, #车辆信息ID
new_indicator char(4), #新保续保标志
newprice_ind char(10), #新车购置价分段
veh_age smallint, #车龄
doctype_id integer not null , #单证类型
thd_ins_id integer, #三者限额ID
risk_indicator char(10) not null , #高风险标志
thd_indicator char(10), #单保三者标志
busi_num integer not null , #业务笔数
insu_num integer not null , #承保数量
policy_sum decimal(16,2) not null , #保单保额(主险保额之和)
insu_sum decimal(16,2) not null , #保险金额(单险种保额)
deposit decimal(16,2) not null , #储金
premium decimal(16,2) not null , #保险费
return_prem decimal(16,2) not null , #安返退费
time_stamp datetime year to second not null , #时间戳
cx_flag char(1) #车险标志
);表是这样的,选择依据policyno那一列。