我正在尝试比较同一个表中的两个字段,字段名称是' start'并且'结束'。对于开始和结束字段,我存储了值00到23。例如
----------------
| start|end|name
===============
00 00 a
01 01 b
02 02 b
03 03 w
. .
. .
23 23 v
所以我要看的是我需要比较开始和结束字段并选择相应的名称。
例如,
如果客户选择start为01并结束为10,那么我需要在这些值之间列出所有名称。
如何在MySQL Query中执行此操作?
答案 0 :(得分:1)
也许我并不理解这么好,但听起来应该尝试这样的事情
SELECT name FROM your_table WHERE( start >= RANGE1 AND end <= RANGE2)
答案 1 :(得分:0)
This will do it
Private Sub setBarco()
Dim numeroRandom As New System.Random()
Dim indiceA, indiceB As Integer
For b = 1 To barcos
Randomize()
Dim value As Integer = CInt(Int((2 * Rnd() + 1)))
indiceA = numeroRandom.Next(0, filas)
indiceB = numeroRandom.Next(0, columnas)
Select Case b
Case 1
If arrayDeCeldas(indiceA, indiceB) = 0 Then
arrayDeCeldas(indiceA, indiceB) = b & 1
End If
Case 2
Select Case value
Case 1
For c = 0 To 1
If indiceB + c < columnas Then
If arrayDeCeldas(indiceA, indiceB + c) = 0 Then
arrayDeCeldas(indiceA, indiceB + c) = b & c
End If
Else
If arrayDeCeldas(indiceA, indiceB - c) = 0 Then
arrayDeCeldas(indiceA, indiceB - c) = b & c
End If
End If
Next
Case 2
For c = 0 To 1
If indiceA + c < filas Then
If arrayDeCeldas(indiceA + c, indiceB) = 0 Then
arrayDeCeldas(indiceA + c, indiceB) = b & c
Else
End If
Else
End If
Next
End Select
Case 3
Case 4
Case 5
Case 6
End Select
Next b
End Sub