如何执行以下SQL查询?
Update my_table
set columnA = 1
where columnID in (select columnID, count(columnID)
from my_table
group by columnID
having count(columnID) = 1)
感谢您的帮助
答案 0 :(得分:0)
您必须匹配比较两侧的字段数。在这种情况下,您可以删除count(*)
,因为您无需在having
子句中选择它以使用它。
Update my_table
set columnA = 1
where columnID in (select columnID
from my_table
group by columnID
having count(columnID) = 1)
答案 1 :(得分:0)
请尝试此查询
import pytesseract
import cv2
originalImg = cv2.imread('tp.png')
originalImg = cv2.resize(originalImg, None, fx=2.5, fy=2.5)
img = cv2.cvtColor(originalImg, cv2.COLOR_BGR2GRAY)
_,img = cv2.threshold(img,100,255,cv2.THRESH_BINARY)
h, w = img.shape
letters = pytesseract.image_to_boxes(img)
letters = letters.split('\n')
letters = [letter.split() for letter in letters]
for letter in letters:
cv2.rectangle(originalImg, (int(letter[1]), h - int(letter[2])), (int(letter[3]), h - int(letter[4])), (0,0,255), 1)
cv2.imshow('', originalImg)