『壹』 怎樣通過一條sql語句查詢得到滿足下面條件的結果,謝謝
select stuId,stuName,decode(mathId,'01','優秀','02','及格',''),decode(engId,'01','優秀','02','及格','') from 表2
select a.stuId,a.stuName,b.type,c.type from 表1 a,表2 b,表2 c where
b.id= a.mathid and c.id= a.engid
這倆都可以!
『貳』 php中mysql一條sql語句查詢出所有符合條件的數據,該怎麼寫
您好,不知道你的a,b兩表有沒有關聯,假定沒有關聯
select count(1)
from
(
select id
from a
where id>5
union all
select id
from b
where id>5
)
『叄』 用一條SQL語句查詢兩張表中的同一欄位滿足條件的數據
select codeid,cedename from table1
union all
select codeid,cedename from table2
~~~~
會把2張表的數據匯總在一起
『肆』 我通過關鍵詞模糊搜索,從資料庫里查詢出符合條件的所有id
加上括弧
tempsql=tempsql&" and ( [proct_name] like '%"& key &"%' or [enproct_name] like '%"& key &"%' or [suoxie] like '%"& key &"%' or [huohao] like '%"& key &"%' )"
『伍』 用sql語句查詢ID號距當前ID號最近的且滿足相關條件的數據
select col_a,id
from (
select col_A,id,row_number() over (partition by col_A order by ABS(id-12345)) as rn
from table
where id<>12345 and col_A='a'
)
where rn=1
『陸』 SQL 2005 用查詢語句顯示符合條件的記錄
是這樣的 這應該是SQL裡面多表連接的語法了。 尋找公共欄位。 也就是兩張表共有的東西。 譬如A表的記錄ID和B表的記錄ID 。
select 操作日期,操作時間,姓名,地址,操作類型名稱 from B表
inner join A表
on A.記錄ID = B.記錄ID
inner join C表
on C.操作類型ID = B.操作類型ID
希望能幫到你,見解有限,多多包涵。
『柒』 sql查詢怎麼在一個表中查詢出滿足ID唯一性的條數,以及整個表的總條數,按照單位分類
select id from biao group by id having count(*)=1
select count(danwei) from biao group by danwei
『捌』 sql查詢符合條件的列
可以用兩表關聯查詢,根據你的需要進行左聯接、右鏈接、內連接,如下面是內連接
select name,....... from syscolumns sc inner join sysobjects so
on sc.id = so.id
where so.type='u'
and so.name='table'
and sc.name like '%a%'
『玖』 SQL 快速查詢出符合條件的內容
select a.id, a.binds from a a, b b
where substr(a.binds, 1, 1) = b.bind
or substr(a.binds, 3, 1) = b.bind
or substr(a.binds, 5, 1) = b.bind
group by a.id, a.binds;
『拾』 sql語句查詢,根據一個表中一個列,該列在兩個不同條件同時滿足的查詢結果
1、在計算機中,打開Foxtable軟體,新建一個表格,比如學生的評價成績表,並輸入數據,如下圖所示。