三列数据
id int,a nvarchar(5),b int
需要一个查询,要求a列不重复,b列取最大值的那列,如果B列同时存在一个以上最大值,取id最大的那列
group by理解不透
分不多,希望大家帮帮忙
[code=SQL]
/*
create table #t(id int,a nvarchar(5) ......
注:我已经把驱动程序放在网站的WEB—INFO的lib下了
tomcat 报错:The server encountered an internal error () that prevented it from fulfilling this request.
Java代码:
*************************************************************************
import java.sql.*;
import java.util.*;
p ......
我用的是:
Connection conn= DriverManager.getConnection(url,user,password);
String sql="updata zhuqiuling set xuanze1=? where name='zhuqiuling'";
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.clearParameters();
pstmt.setString(1,choice);
pst ......
-- --------------------------------------------------------------------------------
-- Routine DDL
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`` PROCEDURE `new_routine`(
_startMonth int,
_En ......
有三个表:
a(ID1,Name1);
b(ID2,Name2);
c(ID1,ID2);
a中ID1对应的数据有:
a1,a2,...,am
b中ID2对应的数据有:
b1,b2,...bn
在Delphi中如何写高效点的语句,使得能够将下面的数据插入到c表中:
a1,b1
a1,b2
...
a1,bn
...
a2,b1
a2,b2
...
a2,bn
...
...
am,b1
am,b2
...
am,bn
我用的是ADOQuery ......
有一个表 a ( id ,c ,d) 和一个 表 b ( id ,a_id )
a表和b表的id都是 自动增长的
但在a表中插入数据的时候 能把该数据的 id 插入 b表中 。
SQL code:
create trigger tri_tb_insert
on a
for insert
as
insert b(aid) select id from inserted
go
帮顶回复内容太短了!
SQL code:
crea ......