這個SQL語句如何改寫

時間 2022-03-28 03:55:03

1樓:匿名使用者

select top 20 sizeid ,count(1) as num, width , height

from adunionclickreport (nolock) ac left join adsize(nolock) ab on ab.id=ac.sizeid

--where reportdate=''

group by sizeid,width , heightorder by num desc

大概這個意思,自己看一下吧

2樓:匿名使用者

select top 20

ac.sizeid ,

count(1) as num,

ad.width as width ,

ad.height as height

from

adunionclickreport (nolock) acjoin adsize(nolock) adon ( ac.sizeid = ad.id)--where reportdate=''

group by ac.sizeid, ad.width , ad.height

order by ac.num desc

3樓:匿名使用者

select top 20 sizeid ,count(1) as num, min(width) width , min(height) height

from adunionclickreport (nolock) ac left join adsize (nolock) on ac.sizeid = adsize.id

--where reportdate=''

group by ac.sizeid

order by num desc

修改一條記錄的sql語句怎麼寫

4樓:卿天亦逮季

你沒明白我的意思,我是想要的是效果原來的選單排序1,2,3.....10,現在插入一條新的選單(11)後,排序變成1,11,2,3......10,一直沒考慮好sql怎麼寫,如果是把11的id變成2,再把後面的id依次加1,這樣我感覺資料庫運算量太大了,如果大家有好的辦法,請告訴我,謝謝。

5樓:比利_嗨靈頓

if--then語句結合

複製** **如下:

update mytable

set myfield = case other_fieldwhen 1 then 'value'

when 2 then 'value'

when 3 then 'value'

endwhere id in (1,2,3)

我們可以使用以下sql語句:

複製** **如下:

update categories

set display_order = case idwhen 1 then 3

when 2 then 4

when 3 then 5

end,

title = case id

when 1 then 'new title 1'

when 2 then 'new title 2'

when 3 then 'new title 3'

endwhere id in (1,2,3)

如何用SQL語句建立檢視,如何用SQL語句建立一個檢視

新模式行業 使用create view語句就可以建立檢視了,具體語句如下 create view viewname as select from tab edsprod tab edsprod是表的名字 where 後面可以接一線限制的條件 刪除檢視 drop view viewname。擴充套件資...

我這個SQL語句對嗎

update 表名 set 列名 要修改的屬性 where 條件 不加where為全部修改 你這樣打應該沒問題的。如果不行試試把time a改成明確的時間,如 update customer set times 2000 where id 單個 如果是多個的話就是,where id in 1,2,3...

英語句子改寫,改寫英語句子

do the children like the ball?are these pens yours?don t put clothese here.when do they get up?按例句改寫英語句子 英語句子成分 5 您輸入了違法字 在英文當中,有八大句子成分,分別是 主語 謂語 賓語 表...