簡體   English   中英

SQL:從表中選擇行,其中列的每個元素都是矩陣?

[英]SQL: select rows from table where each element of a column is a matrix?

我的桌子很大,有幾列。 column_H中的每個元素都是一個2x4的小矩陣,帶有布爾值。

我需要選擇column_H中每行8個布爾元素為False的行。

可能嗎? 怎么樣? (我正在將Python包裝器用於SQL)

好吧,如果您的數據庫支持布爾值,那么您只需執行以下操作:

select t.*
from t
where not bool1 and not bool2 and not bool3 and not bool4 and
      not bool5 and not bool6 and not bool7 and not bool8;

如果您的值是位編碼的,則它們不是“布爾值”。 比較一下可能會起作用:

where column_h = 0

col_H中的每個元素都是一個矩陣,因此我無法直接訪問每個布爾值,而只能直接訪問該矩陣。

由於我將Python包裝器用於SQL,因此我只是想可以混合使用兩種語言:-S

現在我設法使它起作用了! 我的實際代碼是:

select *
from table 
where    col_H[0,0] == False 
      && col_H[0,1] == False 
      && col_H[1,0] == False 
      && col_H[1,1] == False 
      && col_H[2,0] == False 
      && col_H[2,1] == False 
      && col_H[3,0] == False 
      && col_H[3,1] == False 
;

它運作完美。

謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM