Home Database Mysql Tutorial 组合查询之核心:拼接字符串

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

Jun 07, 2016 pm 03:04 PM
character string Splicing Inquire core combination

' 组合 查询 之 核心 : 拼接 字符串 '功能:定义 查询 条件,定义返回集,定义排序方式 '平台: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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

12306 How to check historical ticket purchase records How to check historical ticket purchase records 12306 How to check historical ticket purchase records How to check historical ticket purchase records Mar 28, 2024 pm 03:11 PM

Download the latest version of 12306 ticket booking app. It is a travel ticket purchasing software that everyone is very satisfied with. It is very convenient to go wherever you want. There are many ticket sources provided in the software. You only need to pass real-name authentication to purchase tickets online. All users You can easily buy travel tickets and air tickets and enjoy different discounts. You can also start booking reservations in advance to grab tickets. You can book hotels or special car transfers. With it, you can go where you want to go and buy tickets with one click. Traveling is simpler and more convenient, making everyone's travel experience more comfortable. Now the editor details it online Provides 12306 users with a way to view historical ticket purchase records. 1. Open Railway 12306, click My in the lower right corner, and click My Order 2. Click Paid on the order page. 3. On the paid page

How to check your academic qualifications on Xuexin.com How to check your academic qualifications on Xuexin.com Mar 28, 2024 pm 04:31 PM

How to check my academic qualifications on Xuexin.com? You can check your academic qualifications on Xuexin.com, but many users don’t know how to check their academic qualifications on Xuexin.com. Next, the editor brings you a graphic tutorial on how to check your academic qualifications on Xuexin.com. Interested users come and take a look! Xuexin.com usage tutorial: How to check your academic qualifications on Xuexin.com 1. Xuexin.com entrance: https://www.chsi.com.cn/ 2. Website query: Step 1: Click on the Xuexin.com address above to enter the homepage Click [Education Query]; Step 2: On the latest webpage, click [Query] as shown by the arrow in the figure below; Step 3: Then click [Login Academic Credit File] on the new page; Step 4: On the login page Enter the information and click [Login];

How to repeat a string in python_python repeating string tutorial How to repeat a string in python_python repeating string tutorial Apr 02, 2024 pm 03:58 PM

1. First open pycharm and enter the pycharm homepage. 2. Then create a new python script, right-click - click new - click pythonfile. 3. Enter a string, code: s="-". 4. Then you need to repeat the symbols in the string 20 times, code: s1=s*20. 5. Enter the print output code, code: print(s1). 6. Finally run the script and you will see our return value at the bottom: - repeated 20 times.

How to intercept a string in Go language How to intercept a string in Go language Mar 13, 2024 am 08:33 AM

Go language is a powerful and flexible programming language that provides rich string processing functions, including string interception. In the Go language, we can use slices to intercept strings. Next, we will introduce in detail how to intercept strings in Go language, with specific code examples. 1. Use slicing to intercept a string. In the Go language, you can use slicing expressions to intercept a part of a string. The syntax of slice expression is as follows: slice:=str[start:end]where, s

Detailed explanation of the method of converting int type to string in PHP Detailed explanation of the method of converting int type to string in PHP Mar 26, 2024 am 11:45 AM

Detailed explanation of the method of converting int type to string in PHP In PHP development, we often encounter the need to convert int type to string type. This conversion can be achieved in a variety of ways. This article will introduce several common methods in detail, with specific code examples to help readers better understand. 1. Use PHP’s built-in function strval(). PHP provides a built-in function strval() that can convert variables of different types into string types. When we need to convert int type to string type,

Comparison of similarities and differences between MySQL and PL/SQL Comparison of similarities and differences between MySQL and PL/SQL Mar 16, 2024 am 11:15 AM

MySQL and PL/SQL are two different database management systems, representing the characteristics of relational databases and procedural languages ​​respectively. This article will compare the similarities and differences between MySQL and PL/SQL, with specific code examples to illustrate. MySQL is a popular relational database management system that uses Structured Query Language (SQL) to manage and operate databases. PL/SQL is a procedural language unique to Oracle database and is used to write database objects such as stored procedures, triggers and functions. same

PHP String Operation: Remove Extra Commas and Keep Only Commas Implementation Tips PHP String Operation: Remove Extra Commas and Keep Only Commas Implementation Tips Mar 28, 2024 pm 03:02 PM

PHP String Operation: Remove Extra Commas and Keep Only Commas Implementation Tips In PHP development, string processing is a very common requirement. Sometimes we need to process the string to remove extra commas and retain the only commas. In this article, I'll introduce an implementation technique and provide concrete code examples. First, let's look at a common requirement: Suppose we have a string containing multiple commas, and we need to remove the extra commas and keep only the unique comma. For example, replace "apple,ba

How to convert string to float in PHP How to convert string to float in PHP Mar 27, 2024 pm 12:48 PM

Converting a string to a floating point number is a common operation in PHP and can be accomplished through built-in methods. First make sure that the string is in a legal floating point format before it can be successfully converted to a floating point number. The following will detail how to convert a string to a floating point number in PHP and provide specific code examples. 1. Use (float) cast In PHP, the simplest way to convert a string into a floating point number is to use cast. The way to force conversion is to add (float) before the string, and PHP will automatically convert it

See all articles