我正在创建一个联接表,在该表中我会得到一家销售最多iPhone的商店的名称。我的查询如下所示:
SELECT stores.names, MAX(products.name) from stores
JOIN products on products.id = stores.items_sold
WHERE products.name = "iPhone";
基本上,我得到了MAX
数量最多的iphone
产品,该产品在哪个商店销售最多。该查询仅应退还给我商店名称,仅此而已。这个给了我正确的答案,但是它在MAX
列中打印了产品。我只需要store.name
。
我也尝试过:
SELECT stores.names from stores
JOIN products on products.id = stores.sold_id
WHERE products.name = "iPhone"
GROUP BY store.names
HAVING MAX(products.name);
我只希望能够为查询添加两个条件。只需设置为iphone
,哪个商店销售最多即可。
答案 0 :(得分:1)
您就在那里,只需添加def extractFrames(pathIn, pathOut):
cap = cv.VideoCapture(pathIn)
count = 0
while (cap.isOpened()):
ret, frame = cap.read()
if ret == True:
print('Read %d frame: ' % count, ret)
cv.imwrite(os.path.join(pathOut, "frame{:d}.jpg".format(count)),
frame)
count += 1
else:
break
cap.release()
cv.destroyAllWindows()
函数和pathOut=r'C:\Users\User\Desktop\Frames'
def main():
for i in f:
extractFrames(i, pathOut)
if __name__=="__main__":
main()
子句
aggregate
答案 1 :(得分:0)
-您也可以这样写:
使用with子句
with aa as
(SELECT MAX(p.name) maxname from stores s
JOIN products p on p.id = s.items_sold
WHERE p.name = 'iPhone')
select s.name,aa.maxname
from stores s,products p,aa
where p.name=aa.maxname