搜索
首页数据库mysql教程组合查询之核心:拼接字符串

组合查询之核心:拼接字符串

Jun 07, 2016 pm 03:04 PM
字符字符串拼接查询核心组合

' 组合 查询 之 核心 : 拼接 字符串 '功能:定义 查询 条件,定义返回集,定义排序方式 '平台:Windows 2000 Server + IIS5.0 + SQL Server 2000 '语言:VBScript '作者:Cheery_Ke '***********Start************ '**************读取变量************* .

'组合查询核心拼接字符串
'功能:定义查询条件,定义返回集,定义排序方式
'平台:Windows 2000 Server + IIS5.0 + SQL Server 2000
'语言:VBScript
'作者:Cheery_Ke
'***********Start************
'**************读取变量*************
.
.
.
seaLastUpdTime = Request("seaLastUpdTime1")&"-"&Request("seaLastUpdTime2")&"-"&Request("seaLastUpdTime3")

returnItem = Request("ReturnItem")'******个人设定要返回的字段

'Response.Write returnItem

'***********拼接字符串***************************

If returnItem "" Then

SQL = "Select ComID,ComName, " & returnItem & " From ClientInfo Where ISInva = 0"

Else

SQL = "Select ComID,ComName From ClientInfo where IsInva = 0"

End If

If seaComName "" Then

  SQL = SQL & " And ComName Like '%"&seaComName&"%'"

End If

If seanexus1 "" Then

  SQL = SQL & " And nexus like '%"&seanexus1&"%'"
  
End If

If seanexus2 "" Then

  SQL = SQL & " And nexus like '%"&seanexus2&"%'"
  
End If

If seaComType "" Then

  SQL = SQL & " And ComType = '"&seaComType&"'"

End If

If seaComPRov "" Then

  SQL = SQL & " And ComProv = '"&seaComProv&"'"

End If

If seaTimeFrist11 "" Then

  seaTimeFrist1 = seaTimeFrist11&"-"&seaTimeFrist12&"-"&seaTimeFrist13
  
  SQL = SQL & " And TimeFrist > '"&seaTimeFrist1&"'"

End If

If Request(seaTimeFrist1) "" Then

  seaTimeFrist1 = Request(seaTimeFrist1)
  
  SQL = SQL & " And TimeFrist > '"&seaTimeFrist1&"'"

End If

If seaTimeFrist21 "" Then

  seaTimeFrist2 = seaTimeFrist21&"-"&seaTimeFrist22&"-"&seaTimeFrist23

  SQL = SQL & " And TimeFrist
End If

If Request(seaTimeFrist2) "" Then

  seaTimeFrist2 = Request(seaTimeFrist2)

  SQL = SQL & " And TimeFrist
End If

If seaNearTime11 "" Then

  seaNearTime1 = seaNearTime11&"-"&seaNearTime12&"-"&seaNearTime13
  
  SQL = SQL & " And TimeNear > '"&seaNearTime1&"'"

End If

If Request(seaNearTime1) "" Then

  seaNearTime1 = Request(seaNearTime1)
  
  SQL = SQL & " And TimeNear > '"&seaNearTime1&"'"

End If

If seaNearTime21 "" Then  

  seaNearTime2 = seaNearTime21&"-"&seaNearTime22&"-"&seaNearTime23
  
  SQL = SQL & " And TimeNear   
End If

If Request(seaNearTime2) "" Then  

  seaNearTime2 = Request(seaNearTime2)
  
  SQL = SQL & " And TimeNear   
End If

If seaAppTime11 "" Then

  seaAppTime1 = seaAppTime11&"-"&seaAppTime12&"-"&seaAppTime13
  
  SQL = SQL & " And AppTime > '"&seaAppTime1&"'"

End If

If Request(seaAppTime1) "" Then

  seaAppTime1 = Request(seaAppTime1)
  
  SQL = SQL & " And AppTime > '"&seaAppTime1&"'"

End If

If seaAppTime21 "" Then

  seaAppTime2 = seaAppTime21&"-"&seaAppTime22&"-"&seaAppTime23
  
  SQL = SQL & " And AppTime
End If

If Request(seaAppTime2) "" Then

  seaAppTime2 = Request(seaAppTime2)
  
  SQL = SQL & " And AppTime
End If

If Request("seaLastUpdTime1") "" Then

//  seaLastUpdTime0 = seaLastUpdTime1&"-"&seaLastUpdTime2&"-"&seaLastUpdTime3
  
  SQL = SQL & " And LastUpdTime > '"&seaLastUpdTime&"'"

End If

If Request(seaLastUpdTime1) "" Then

  //seaLastUpdTime0 = Request(seaLastUpdTime0)

  SQL = SQL & " And LastUpdTime > '"&seaLastUpdTime&"'"

End If

If session("Pop") = "1" Then

  AdminName = Session("UserName")

SQL = SQL & " And (OurSales Like '%"&AdminName&"%' Or nexus Like '%w%') Order By " & Order

Else

Response.Write SQL

SQL = SQL & " Order By "& Order 'Order设定排序方式

End If

'Response.Write SQL

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
MySQL字符串类型:存储,性能和最佳实践MySQL字符串类型:存储,性能和最佳实践May 10, 2025 am 12:02 AM

mySqlStringTypesimpactStorageAndPerformanCeaseAsfollows:1)长度,始终使用theSamestoragespace,whatcanbefasterbutlessspace-felfficity.2)varCharisvariable varcharisvariable length,morespace-morespace-morespace-effficitybuteftife buteftife butfority butfority textifforlyslower.3)

了解MySQL字符串类型:VARCHAR,文本,char等了解MySQL字符串类型:VARCHAR,文本,char等May 10, 2025 am 12:02 AM

mySqlStringTypesIncludeVarChar,文本,char,enum和set.1)varCharisVersAtileForvariable-lengthStringStringSuptOptoPeptoPepecifientlimit.2)textisidealforlargetStortStorStoverStorextorewiteWithoutAdefinedLengthl.3)charlisfixed-Length

MySQL中的字符串数据类型是什么?MySQL中的字符串数据类型是什么?May 10, 2025 am 12:01 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

如何向新的MySQL用户授予权限如何向新的MySQL用户授予权限May 09, 2025 am 12:16 AM

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

如何在MySQL中添加用户:逐步指南如何在MySQL中添加用户:逐步指南May 09, 2025 am 12:14 AM

toadduserInmysqleffectection andsecrely,theTheSepsps:1)USEtheCreateuserStattoDaneWuser,指定thehostandastrongpassword.2)GrantNectalRevileSaryPrivilegesSustate,usiveleanttatement,AdheringTotheTeprinciplelastPrevilegege.3)

mysql:添加具有复杂权限的新用户mysql:添加具有复杂权限的新用户May 09, 2025 am 12:09 AM

toaddanewuserwithcomplexpermissionsinmysql,loldtheSesteps:1)创建eTheEserWithCreateuser'newuser'newuser'@''localhost'Indedify'pa ssword';。2)GrantreadAccesstoalltablesin'mydatabase'withGrantSelectOnMyDatabase.to'newuser'@'localhost';。3)GrantWriteAccessto'

mysql:字符串数据类型和coltrationsmysql:字符串数据类型和coltrationsMay 09, 2025 am 12:08 AM

MySQL中的字符串数据类型包括CHAR、VARCHAR、BINARY、VARBINARY、BLOB、TEXT,排序规则(Collations)决定了字符串的比较和排序方式。1.CHAR适合固定长度字符串,VARCHAR适合可变长度字符串。2.BINARY和VARBINARY用于二进制数据,BLOB和TEXT用于大对象数据。3.排序规则如utf8mb4_unicode_ci忽略大小写,适合用户名;utf8mb4_bin区分大小写,适合需要精确比较的字段。

MySQL:我应该在Varchars上使用什么长度?MySQL:我应该在Varchars上使用什么长度?May 09, 2025 am 12:06 AM

最佳的MySQLVARCHAR列长度选择应基于数据分析、考虑未来增长、评估性能影响及字符集需求。1)分析数据以确定典型长度;2)预留未来扩展空间;3)注意大长度对性能的影响;4)考虑字符集对存储的影响。通过这些步骤,可以优化数据库的效率和扩展性。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

安全考试浏览器

安全考试浏览器

Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。

VSCode Windows 64位 下载

VSCode Windows 64位 下载

微软推出的免费、功能强大的一款IDE编辑器

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)