-- select * from yonghu where login_name='lhp' and login_pwd='123'
-- select * from juese
-- select * from yonghu where yonghu_id=1
--select juese_id from juese where juese_id=2
-- select * from juese where juese_id in(
-- select juese_id from yonghu_juese where yonghu_id=
-- (select yonghu_id from yonghu where login_name='lhp' and login_pwd='123')
-- )
-- select * from yonghu
-- select * from yonghu where login_name='lhp' and login_pwd='123'
-- select * from juese
--select juese_id from yonghu_juese where yonghu_id=1
--select * from juese where juese_id=2
select * from juese
where juese_id in(
select juese_id from yonghu_juese
where yonghu_id=(
select yonghu_id from yonghu where login_name='cx' and login_pwd='456'
))
select * from juese j,juese_quanxian jq ,quanxian q
where j.juese_id=jq.juese_id and jq.quanxian_id=q.quanxian_id
select * from juese j ,juese_quanxian jq, quanxuan q where j.juese_id=jq.juese_id and jq.quanxian_id=q.quanxuan_id
select * from quanxuan q,quanxian_caidan qc,caidan c
where q.quanxuan_id=qc.quanxian_id and qc.caidan_id=c.caidan_id
select y.*,c.* from
yonghu y,yonghu_juese yj,juese j
,juese_quanxian jq ,quanxuan q
,quanxian_caidan qc,caidan c
where y.yonghu_id=yj.yonghu_id and yj.juese_id=j.juese_id
and j.juese_id=jq.juese_id and jq.quanxian_id=q.quanxuan_id
and q.quanxuan_id=qc.quanxian_id and qc.caidan_id=c.caidan_id
and y.login_name='lhp' and y.login_pwd='123'
select * from v_yonghu_caidan where login_name='jzs' and login_pwd='789'
吧這寫語句放這裡---用的時好找-----------------------------
T SQL語句 多表查詢
1.內連線 內連線 inner join 只返回兩個資料集合之間匹配關係的行,將位於兩個互相交叉的資料集合中重疊部分以內的資料行連線起來。內連線使用比較運算子進行表間某些列資料的比較操作,並列出這些表中與連線相匹配的資料行。select a.name 姓名a,a.school 學校a,b.name ...
6 多表查詢語句
六 多表查詢語句 連線型別 自然連線 natural joins 外連線 outer joins 交叉連線 cross joins 建立自然連線 1 兩個表中所有相同名字的列 2 選取匹配列的相同值 3 列的資料型別要一致 select e.ename,e.job,e.sal,d.dname fro...
多表鏈結查詢語句
多表查詢常涉及到到表連線的問題,主要涉及到內連線 inner join 外連線 left join or left outer join right join or right outer join full join 和交叉連線 cross join inner join 也叫等值鏈結。內連線具有...