求SQL:满足条件的第一条记录 table1 字段:BoxCode,CartonCode一个Carton装多个Box ,即1:n现要在table1中找出每个Caron中的一个Box 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select BoxCode,CartonCodefrom table1group by BoxCode,CartonCode select BoxCode,max(CartonCode)from table1group by BoxCode Select max(boxcode),cartoncodefrom tbgroup by cartoncode select BoxCode,CartonCodefrom tb a where BoxCode=(select max(BoxCode) from tb where CartonCode=a.CartonCode) select BoxCode,CartonCodefrom table1where exists(select top 1 BoxCode,CartonCode from table1 where CartonCode = A.cartoncode)TRY 新手跪求一SQL Exec 返回的表 如何 用于其它的select 求个sql语句,很简单 SQL Server权限设定 随机抽取数据 关于分布式数据同步的问题。。。 高分求解 存储过程参数问题 传递到 SUBSTRING 函数的长度参数无效(搞不清思路) SQL数据库如何转换成ACCESS数据库? 请问SQL 2000 SERVER必须要安装在WIN 2000 SERVER上吗?SQL70不是都可以安装在WIN 2000 PRO上吗? 查询当前数据库中所有的表 【求助】如何查询某一字段中某个字符的值
from table1
group by BoxCode,CartonCode
BoxCode,max(CartonCode)
from
table1
group by
BoxCode
from tb
group by cartoncode
from tb a
where BoxCode=(select max(BoxCode) from tb where CartonCode=a.CartonCode)
from table1
where exists(select top 1 BoxCode,CartonCode from table1 where CartonCode = A.cartoncode)
TRY