双表联合查询:
SELECT * FROM T_CDXXB INNER JOIN T_JSQXB ON T_CDXXB.ID=T_JSQXB.CDID WHERE T_JSQXB.JSID=?
从T_JSQXB 中通过T_JSQXB.JSID 查出T_CDXXB中的多个CDID
sql去掉重复:
select distinct job from emp where comm is not null;
找出各月倒数第3 天受雇的员工。
select * from emp where LAST_DAY(hiredate)-2=hiredate;
找出早于12年前受雇的员工。
select * from emp where MONTHS_BETWEEN(sysdate,hiredate)/12 >12;