Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sql ¼òµ¥É¾³ýÎÊÌâ

SQL code:
±íA
id name
1 aa
2 aa
3 aa
4 bb
5 cc
6 cc
7 ee
8 ff
9 ff


ÎÒÏëɾ³ý±íAÖÐnameÖØ¸´µÄ¼Ç¼
Ö»Áôid×î´óµÄÄÇÒ»¸ö
¸ù¾Ý±íAɾ³ýºóµÄ½á¹ûΪ£º

id name
3 aa
4 bb
6 cc
7 ee
9 ff


ÄÄλ֪µÀµÄ°ïÎÒ½â¾öÏÂ
лл
SQL code:
select max(ID)ID,
name
from tb group by name


SQL code:
---²âÊÔÊý¾Ý---
if object_id('[A]') is not null drop table [A]
go
create table [A]([id] int,[name] varchar(2))
insert [A]
select 1,'aa' union all
select 2,'aa' union all
select 3,'aa' union all
select 4,'bb' union all
select 5,'cc' union all
select 6,'cc' union all
select 7,'ee' union all
select 8,'ff' union all
select 9,'ff'

---ɾ³ý---
delete a
from a t
where not exists(select 1 from a where name=t.name and id<t.id)

---²éѯ---
select * from [A]

---½á¹û---
id name
----------- ----
2 aa
3 aa
6 cc
9 ff

£¨ËùÓ°ÏìµÄÐÐÊýΪ 4 ÐУ©


delete from A where not exists ( select 1 from (select max(id) A_id,name&nbs


Ïà¹ØÎÊ´ð£º

sqlת»»ÎÊÌ⣬¼±£¡ - ÉçÇøÖ§³Ö / ¡¶³ÌÐòÔ±¡·ÔÓÖ¾

select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......

jspÁ´½Ósql2000µÄÒÉÎÊ£¿



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

ÇóÒ»sql¡¾Ð»Ð»¡¿ - MS-SQL Server / »ù´¡Àà

ÐèÇóÈçÏ£º
a±í:
 p_id status  
  1 0
  2 0
b±í
rec_id pid purchase_qty receive_qty flag
1 1 10 10 0
2 ......

¶à±í¹ØÁª²éѯµÄ sqlд·¨ - Oracle / »ù´¡ºÍ¹ÜÀí

´ó¼ÒºÃ£¬ÎÒ×î½üά»¤Ò»¸öÏîÄ¿£¬100¶à¸ö±í
Ö»ÄÜÓÃjdbcÖ±Á¬
Óöµ½Á˶à¸ö±í ¹ØÁª ²éѯµÄÇé¿ö Çë´ó¼ÒÖ¸½Ì
±ÈÈç
student(studentid,classid)
class(classid,classname)
class_teacher(classid,teacherid)Õâ¸öÊÇÖмä±í ......

Çë½ÌsqlÓï¾ä¡£ - Oracle / ¿ª·¢

ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
  ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ