求sql語句,pl,求乙個sql語句,pl sql

時間 2022-03-24 19:35:41

1樓:匿名使用者

select birthday

from (select birthday, '1' dfrom a

where to_char(sysdate, 'mmdd') <= to_char(birthday, 'mmdd')

union all

select birthday, '2' d from a where to_char(sysdate, 'mmdd') > to_char(birthday, 'mmdd'))

order by d, birthday

2樓:匿名使用者

select * from 表 order by datediff(dd,getdate(),convert(date,str(year())+'-'+left(birth,2)+'-'+right(birth,2))) asc

手寫的沒調 你自己除錯一下吧

3樓:石亮東

select * from tablename

order by

sysdate-(to_date(to_char(sysdate,'yyyy')||to_char(birthday,'mmdd'),'yyyymmdd')

4樓:我tm不管

經驗證,賓士的答案是正解!

5樓:

賓士m888 、ytbelwxg 好酷的等級

幫我寫sql語句,幫我寫乙個sql語句

遇到不為null的值時返回0.邏輯有問題?遇到是null返回0 是這個意思嗎?不管怎麼樣,給你乙個小例子 declare test varchar 300 set test null select isnull test,abc 裡面顯示abc isnull函式的作用為 select isnull ...

關於Sql語句的問題,乙個關於Sql語句的問題

create table temp id int null,uid int null,name nvarchar 50 null create table temp1 id int null,class nvarchar 50 null,users nvarchar 50 null insert i...

求SQL2000乙個查詢語句

兩種方法,一 直接開啟查詢分析器,將滑鼠定位到 開始 所有程式 ms sqlserver2000 查詢分析器,單擊就可以開啟查詢分析器了,但是要注意,一般開啟之前有乙個選項讓你填寫,如果你不是用sa使用者或者其他自己建立的應戶名登入的話,選擇使用windows本地賬戶,就可以了,就是不需要填寫使用者...

求一條sql語句

我提供的思路如下 select 成績 from a a1 where name 張三 and 成績 in select 成績 from a a2 where name 李四 思路就是外層查詢出所有張三的成績,再在這個集合中通過子查詢出李四的成績來進行篩選,選出來在張三成績集合中存在且又在李四成績集合...

php mysql求一句sql語句

select from select id,substr id,1,2 dd,to number substr id,3 ss from table 0 t order by dd desc ss desc試試這個,再列傳行,應該就可以了 select 欄位名 from 表名 order by 欄位...