当前位置:首页 > 网络编程 > 数据库 > SQL Server > 一些有用的sql语句实例

一些有用的sql语句实例

点击次数:29 次 发布日期:2008-11-21 22:44:10 作者:源代码网
源代码网推荐

源代码网整理以下1Examples

源代码网整理以下


源代码网整理以下=======================================

源代码网整理以下selectid,age,FullnamefromtableOnea
wherea.id!=(selectmax(id)fromtableOnebwherea.age=b.ageanda.FullName=b.FullName)

源代码网整理以下=========================================

源代码网整理以下deletefromdbo.Schedulewhere

源代码网整理以下RoomID=29andStartTime>"2005-08-08"andEndTime<"2006-09-01"andRemarklike"preset"andUserID=107

源代码网整理以下and(

源代码网整理以下(ScheduleID>=3177andScheduleID<=3202)

源代码网整理以下or(ScheduleID>=3229andScheduleID<=3254)

源代码网整理以下or(ScheduleID>=3307andScheduleID<=3332)

源代码网整理以下=========================================

源代码网整理以下deletetableOne
wheretableOne.id!=(selectmax(id)fromtableOnebwheretableOne.age=b.ageandtableOne.FullName=b.FullName);

源代码网整理以下==========================================

源代码网整理以下DataClient12/23/20055:03:38PM

源代码网整理以下selecttop5

源代码网整理以下DOC_MAIN.CURRENT_VERSION_NOasVersion,DOC_MAIN.MODIFY_DATEasModifyDT,DOC_MAIN.SUMMARYasSummary,DOC_MAIN.AUTHOR_EMPLOYEE_NAMEasAuthorName,DOC_MAIN.TITLEasTitle,DOC_MAIN.DOCUMENT_IDasDocumentID,Attribute.ATTRIBUTE_IDasAttributeId,Attribute.CATALOG_IDasCatalogId,DOC_STATISTIC.VISITE_TIMESasVisiteTimes,DOC_STATISTIC.DOCUMENT_IDasDocumentID2

源代码网整理以下fromDOC_MAINDOC_MAIN

源代码网整理以下InnerjoinCATALOG_SELF_ATTRIBUTEAttributeonDOC_MAIN.CATALOG_ID=Attribute.CATALOG_ID

源代码网整理以下LeftjoinDOC_STATISTICDOC_STATISTIConDOC_MAIN.DOCUMENT_ID=DOC_STATISTIC.DOCUMENT_ID

源代码网整理以下where(DOC_MAIN.AUTHOR_EMPLOYEE_ID=1)and(Attribute.ATTRIBUTE_ID=11)

源代码网整理以下orderbyVisiteTimesDESC

源代码网整理以下====================================

源代码网整理以下selecttop1DOCUMENT_ID,EMPLOYEE_NAME,COMMENT_DATE,COMMENT_VALUE

源代码网整理以下fromdbo.DOC_COMMENT

源代码网整理以下whereDOCUMENT_ID=19andCOMMENT_DATE=(selectmax(COMMENT_DATE)fromDOC_COMMENTwhereDOCUMENT_ID=19)

源代码网整理以下====================================

源代码网整理以下selectTITLE,(selecttop1EMPLOYEE_NAME

源代码网整理以下fromdbo.DOC_COMMENTwhereDOCUMENT_ID=19)Commentman,

源代码网整理以下(selecttop1COMMENT_DATE

源代码网整理以下fromdbo.DOC_COMMENTwhereDOCUMENT_ID=19)COMMENT_DATE

源代码网整理以下fromDOC_MAINwhereDOCUMENT_ID=19

源代码网整理以下======================================

源代码网整理以下alterviewExpertDocTopComment

源代码网整理以下as

源代码网整理以下selectDOCUMENT_ID,max(ORDER_NUMBER)aslastednum

源代码网整理以下fromdbo.DOC_COMMENT

源代码网整理以下groupbyDOCUMENT_ID

源代码网整理以下go

源代码网整理以下alterviewExpertDocView

源代码网整理以下as

源代码网整理以下selectTITLE,a.AUTHOR_EMPLOYEE_ID,c.EMPLOYEE_NAME,c.COMMENT_DATE

源代码网整理以下fromdbo.DOC_MAINa

源代码网整理以下leftjoin

源代码网整理以下ExpertDocTopCommentb

源代码网整理以下on

源代码网整理以下a.DOCUMENT_ID=b.DOCUMENT_ID

源代码网整理以下innerjoin

源代码网整理以下DOC_COMMENTc

源代码网整理以下on

源代码网整理以下b.DOCUMENT_ID=c.DOCUMENT_IDand

源代码网整理以下b.lastednum=c.ORDER_NUMBER

源代码网整理以下======================================

源代码网整理以下selecta.Id,a.WindowsUsername,

源代码网整理以下0,1,

源代码网整理以下a.Email,

源代码网整理以下caseb.EnFirstNamewhennullthena.Usernameelseb.EnFirstNameend,

源代码网整理以下caseb.EnLastNamewhennullthena.Usernameelseb.EnLastNameend

源代码网整理以下fromUUMS_KM.dbo.UUMS_Usera

源代码网整理以下leftjoin

源代码网整理以下UUMS_KM.dbo.HR_Employeeb

源代码网整理以下on

源代码网整理以下a.HR_EmployeeId=b.id

源代码网整理以下=====================================

源代码网整理以下列出上传文档最多的五个人的ID

源代码网整理以下selectAUTHOR_EMPLOYEE_ID,count(AUTHOR_EMPLOYEE_ID)

源代码网整理以下fromdbo.DOC_MAIN

源代码网整理以下groupbyAUTHOR_EMPLOYEE_ID

源代码网整理以下orderbycount(AUTHOR_EMPLOYEE_ID)

源代码网整理以下27192

源代码网整理以下69

源代码网整理以下1230

源代码网整理以下1116

源代码网整理以下列出上传文档最多的五个人的信息

源代码网整理以下selectdistinctAUTHOR_EMPLOYEE_ID,AUTHOR_EMPLOYEE_NAME

源代码网整理以下fromdbo.DOC_MAIN

源代码网整理以下whereAUTHOR_EMPLOYEE_ID

源代码网整理以下in(

源代码网整理以下selecttop5AUTHOR_EMPLOYEE_ID

源代码网整理以下fromdbo.DOC_MAIN

源代码网整理以下groupbyAUTHOR_EMPLOYEE_ID

源代码网整理以下orderbycount(AUTHOR_EMPLOYEE_ID)

源代码网整理以下)

源代码网整理以下=================================

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华