我使用SELECT语句在表中选择了一个特定的ROW。在这一行中,我想找到包含特定字符串的列。
import websocket
import thread
import time
import json
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
def on_open(ws):
print("ONOPEN")
def run(*args):
ws.send(json.dumps({'command':'subscribe','channel':1001}))
ws.send(json.dumps({'command':'subscribe','channel':1002}))
ws.send(json.dumps({'command':'subscribe','channel':1003}))
ws.send(json.dumps({'command':'subscribe','channel':'BTC_XMR'}))
while True:
time.sleep(1)
ws.close()
print("thread terminating...")
thread.start_new_thread(run, ())
if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.WebSocketApp("wss://api2.poloniex.com/",
on_message = on_message,
on_error = on_error,
on_close = on_close)
ws.on_open = on_open
ws.run_forever()
我想知道哪个列包含字符串E.谢谢。
答案 0 :(得分:1)
您可以执行以下操作:
select (case when col1 = 'E' then 'col1'
when col2 = 'E' then 'col2'
when col3 = 'E' then 'col3'
when col4 = 'E' then 'col4'
when col5 = 'E' then 'col5'
end)
如果您只想要索引:
select field('E', col1, col2, col3, col4, col5)