請教SQL高手幫忙!謝謝,SQL高手幫幫忙 謝謝

2022-02-17 10:05:14 字數 2397 閱讀 6068

1樓:匿名使用者

問題很簡單,沒有表結構,做不了

sql高手幫幫忙!謝謝!

2樓:西北癲貓

這樣都成嗎?拿網易相簿不是很好做了,呵呵

3樓:

9494

而且存路徑也省空間~~~

4樓:

我同意樓上的兄弟說的,只要存路徑就行了,存**的過程很麻煩.

5樓:憶天

用二進位製流寫進去就可以了

請教sql查詢問題,高手請進,感謝!

6樓:

select type,typeid,code,name,(select rtrim((select ' '+rtrim(context)+' ' from 表名 where typeid=w.typeid order by id  for xml path ('')))) context

from 表名 w

where code='000'

7樓:匿名使用者

select

type,

typeid,

code,

name,

(select wm_concat(context,' ') from table_name where type=t1.type and typeid=t1.typeid) context

from table_name t1 where code=000;

至於後面context的英文順序是無法保證了,因為表中都沒有乙個排序來控制。

8樓:

如果資料庫支援xml的話, 可以利用xml將context組合成乙個字串,然後用replace替換掉xml標記。以sql server 2005或以上版本為例:

-- 定義示例表變數,並插入示例資料

declare @tb table (id int, type nvarchar(10), typeid nvarchar(10), code nvarchar(30), name nvarchar(30), context nvarchar(30))

insert into @tb

select 1, 'a', 'a_1', '999', 'a', 'hello'

union select 3, 'a', 'a_1', '999', 'b', '!'

union select 2, 'a', 'a_1', '000', '名稱a', 'world'

-- 執行查詢, 主要在replace中查詢到相同的type, typeid的context值,並用for xml組合成乙個字串,然後用3個replace來替換掉xml標記,得到需要的context內容

select s.type, s.typeid, s.

code, s.name, replace(replace(replace((select v.context as t1 from @tb v where v.

type = s.type and v.typeid = s.

typeid order by v.id for xml path('')), '

', ''), '', ''), '', '') as context

from @tb s

執行結果如下圖,

如果資料庫比較舊,不支援xml, 那麼可以自己建乙個函式來實現context內容的合併。

9樓:暈這都有人起了

select 類別(type) , 類別id(typeid) , 返回碼(code) , 名稱(name), 文字(context)

from table where 類別id(typeid)=000

請教:高手幫忙呀!謝謝了.

10樓:純粹不知道

網易的網盤 有嗎? 這個不是太大的還可以

很急!請教sql高手!

11樓:手機使用者

select case

when len(idcard)=18 then substring(idcard,7,8)

else cast('19'+substring(idcard,7,6)

endas birdate

12樓:手機使用者

你的意思是在程式設計的時候,需要根據輸入的身份證號,直接在生日裡出現,而且寫入到資料庫中;

如果是這樣的話,不僅僅是根據身份證號的字串組成生日字串,而且還是根據資料庫字段型別進行轉換,一般來說日期都有自己的格式,不只是字元哦

求救SQL高手,求救SQL高手

select a.sno,sc.cno,cname grade 要查詢的相關字段 from student a,sc b,course c 從這幾個表中查,分別令個別名a,b,c where a.sno b.sno and b.cno c.cno student 表與sc 表sno欄位相同 且 sc...

請教高手安裝sql2019時提示

出現你說的這個提示後,關閉電腦上的所有的防毒軟體,然後再點確定,就可以了。如果還是不行,就把登錄檔和c盤的sql相關檔案再清理一次,再重灌就行。登錄檔和c盤相關路徑如圖 注 如果是64位的電腦,c盤路徑是c program files x86 如果重灌還是不行,就換個作業系統吧 我試了好幾次,也出現...

幫忙做下這些SQL題目,SQL題目 幫忙做下

判斷題 錯對錯錯錯 填空題 1tempdb 2sp helpdb 3distinct 4dbms 選擇題 cbacddbacd 操作題 1 select 學號,姓名,年齡 from 學生 where 學號 s 2 select distinct s.學號,count sc.課程號 from 學生 s...