/*
查詢銷量前10名的產品名稱
*/use northwind
-- 採用子查詢的方式
select p.productid, p.productname
from products as p
where p.productid in
(select p_top10.productid from
(select top 10 productid, sum(quantity) as totalquantity
from [order details] as od
group by productid
order by totalquantity desc
) as p_top10
)-- 採用表連線的方式
select p.productid, p.productname, od_top10.totalquantity
from products as p join
(
select top 10 productid, sum(quantity) as totalquantity
from [order details] as od
group by productid
order by totalquantity desc
) as od_top10
on p.productid=od_top10.productid
-- order by od_top10.totalquantity
--use northwind
select employeeid as id,(lastname+' '+firstname)as empname
from employees as e
where exists
(select * from orders as o
where e.employeeid=o.employeeid
and o.orderdate='9/5/1997'
)
sqlserver 查詢 10 秒前的資料
很多時候我們查詢 sqlserver 10 秒前的資料,然後做一些處理,這種時間的處理,就是需要我們使用函式 datediff 如果是查詢 10 秒前 的資料 select from dbo 表名 where datediff s,createtime getdate 10order by crea...
2023年排名前10的Python庫
歡迎來到我們的python頂級庫列表 規則很簡單。我們正在尋找滿足以下條件的庫 它們於2020年推出或普及。自啟動資料以來,它們一直得到很好的維護。它們非常酷,您應該檢查一下它們。因此,事不宜遲,讓我們開始吧。您不一定總是需要編寫cli應用程式,但這樣做時最好是沒有麻煩的體驗。繼fastapi取得巨...
查詢10天前的日誌並刪除
查詢10天前的日誌並刪除 bin bash source etc profile 刪除日誌 find usr local apache tomcat 7.0.68 logs type f mtime 10 exec rm rfv find usr local apache tomcat 8.0.32...