請教sql語句中引數的寫法,請教sql語句中一個引數的寫法。

時間 2022-02-15 11:30:06

1樓:匿名使用者

roomid=''+@rroomid +''

就可以了

在字串裡''等於一個' 你寫一個肯定報錯

2樓:

型別問題吧

改成roomid='+convert(varchar(10),@rroomid)+'

試試看。

還有一點就是沒給@rroomid 賦值

3樓:

roomld = ""+@roomid+""行嗎?

請教一個sql語句的寫法?

4樓:匿名使用者

你試一下這樣呢,把uid=1的取出來當作一張新表,然後更新原表uid=2的資料

update tablename a,(select name,xml from tablename where uid=1)b

set a.xml = b.xml

where a.uid =2

and a.name = b.name

望採納。

5樓:

你是想把空的內容填寫上吧?

update tablename set xml=b.xmlfrom tablename a,

(select *from tablename where xml is not null and uid=1) b --提取不為空的內容

where a.name=b.name

and a.xml is null --定位為空的位置and a.uid=2; --定位為空的位置

6樓:匿名使用者

update a set a.xml=b.xml from 表名 a,表名 b where a.

uid=1 and b.uid=2 and a.name=b.

name

請教一個sql語句的寫法

7樓:匿名使用者

create table temptest (

order_no number,

no varchar2(1000),

status varchar2(2)

)insert into temptest values(2011001, '0001', 'a');

insert into temptest values(2011001, '0002', 'b');

insert into temptest values(2011001, '0003', 'c');

insert into temptest values(2011002, '0001', 'a');

insert into temptest values(2011002, '0002', 'c');

insert into temptest values(2011002, '0003', 'c');

insert into temptest values(2011002, '0003', 'c');

insert into temptest values(2011003, '0001', 'b');

insert into temptest values(2011003, '0002', 'b');

insert into temptest values(2011003, '0003', 'c');

commit;

select distinct t1.no, t1.status from temptest t1 where t1.

status = 'c' and t1.no not in (

(select distinct t.no from temptest t where t.status <> 'c'))

8樓:匿名使用者

select * from 一個表 where not exists(select 單據號,編號 from 一個表 where 狀態 in ('a','b'))

9樓:

看你的sql應該是sql server 2005以上

rownumber是結果列的別名,必須放在自查詢外。換而言之,rownumber並不是你的users表的實際列。所以只能放到一個子查詢外部,然後取rownumber = 1.

select *

from(select row_number() over(partition by jichengshang

order by cpid) as rownumber,cpid,username,userpass2,

xiangmumingcheng,jichengshang

from users

where (select myuser from users where cpid=1009)

like '%'+convert(varchar,users.cpid)+'%') t

where rownumber = 1

10樓:匿名使用者

select distinct 編號,狀態

from testb

where 狀態 ='c' and 單據號 not in (select 單據號 from testb where 狀態 in ('a','b'))

請教一個sql 語句的寫法! 5

11樓:

update table1 set table1.成績 = (select t.成績 from table1 t where t.

姓名= table1.姓名 and t.學期='1') where table1.

學期='2'

12樓:

是不是把2改為1,還是要把成績也改掉,

update 表名 set 學期=1 where 學期=1

13樓:匿名使用者

哦 意思是把學期等於2的成績都改成和1一樣然後拿姓名做改變是吧

應該是不能實現吧 因為每次的姓名與編號都是不一樣的所以不可能在一句裡改所有的值

請教sql語句寫法

14樓:

15樓:匿名使用者

首先,你用的什麼資料庫阿。那種資料庫的sql中沒有內建split方法把

如果沒有,你可以自己做個split的儲存過程,然後呼叫。

請教一條sql語句的寫法

16樓:匿名使用者

瀏覽量從多到少排列。

select c.n_class,s_count from (select a.n_class,count(s_id) as s_count from news a,scan b where a.

n_id=b.s_nid group by a.n_class) c order by s_count desc

瀏覽時間從多到少排列。

select c.n_class,t_time from (select a.n_class,sum(s_time) as t_time from news a,scan b where a.

n_id=b.s_nid group by a.n_class) c order by t_time desc

用函式的話,你自己加進去呼叫就行了。

請教這樣一個sql查詢語句的寫法

17樓:

select [id], (select count(1) from t a where a.id=t.id and left( [descript],1)='a') as a類數量, (select count(1) from t b where b.

id=t.id and left( [descript],1)='b') as b類數量 from t group by id

18樓:匿名使用者

select id,

sum(case when no like 'a%' then 1 else 0 end),

sum(case when no like 'b%' then 1 else 0 end),

from t

group by id

19樓:西安_白小鵬

select id,count(case when left(no,1)='a' then 1 else 0 end) as a類數量,count(case when left(no,1)='b' then 1 else 0 end) as b類數量

from t group by id

sql語句中的符號是什麼意思,sql 語句中 符號是什麼意思?

以下希望對你有所幫助。儘管宣告字串常量的標準方法通常都很方便,但是如果字串包含很多單引號或者反斜槓,那麼理解字串的內容可能就會變得很苦澀,因為每個單引號都要加倍。為了讓這種場合下的查詢更具可讀性,postgresql 允許另外一種稱作 美元符包圍 的字串常量宣告辦法。一個通過美元符包圍宣告的字串常量...

問SQL語句的寫法,問一個SQL語句的寫法

不知道你是直接在儲存過程中還是要在程式中使用。程式中使用比較簡單,將sql語句作為一個字串,按照傳過來的變數隨意拼裝即可,然後進行執行。如果是儲存過程或資料庫函式中,除了直接寫sql語句外,也可以通過動態sql處理,也就是把sql語句作為字串處理,然後執行。巨集定義字串解決方式 巨集定義 date ...

sql語句中的like語句中和的區別

鈾氶瓏鈾 是一個實際的字元,而 是萬用字元,兩個不是一個概念sql中的萬用字元 才代表任意字元,在sql中沒有萬用字元的意思,雖然在像dos環境之類下是代表任意字元的意思 elect from sysuser a where a.login name like sys 等於select from s...