0
我需要一个MySQL函数来评估状态代码...MySQL,我的函数将如何评估一个数字?
在我的程序中,这是我如何评估它。但是,在SQL中,我想要选择具有特定原因的所有状态码。你可以在下面看到原因,并且可以设置多个。
Sub InterpretReasonCode(ByVal pintCode As Integer)
If pintCode >= 16 Then
pintCode -= 16
mbooBlacklistedDomain = True
End If
If pintCode >= 8 Then
pintCode -= 8
mbooSneakedURLChanged = True
End If
If pintCode >= 4 Then
pintCode -= 4
mbooRetriedFailedToAccess = True
End If
If pintCode >= 2 Then
pintCode -= 2
mbooRequestedByAuthor = True
End If
If pintCode >= 1 Then
pintCode -= 1
mbooBlackListed = True
End If
End Sub
我的SQL语句会是这个样子
Select * from MyTable where Eval_Func(StatusCode,8) = true;
今后我将扩展功能,包括不同的标志,.eg 32,64,128,256等
那么我应该怎么做,理想情况下,我不想为状态添加新表并为每个状态创建一个字段看起来很疯狂。 – Jules 2011-01-07 13:35:00