发布网友 发布时间:2022-04-21 07:23
共2个回答
热心网友 时间:2022-06-18 16:48
使用UNION
select DEPT_NAME, USER_NAME, PHONE, CONTENT, SEND_TIME from sms3
UNION ALL
select DEPT_NAME,SENDER_NAME,MOBIL_NO ,CONTENT,DIA_TIME from diary
在每个select 语句中可以使用where 条件指定数据
两个表的对应列类型最好一致
SELECT ...
UNION [ALL | DISTINCT] SELECT ...
[UNION [ALL | DISTINCT] SELECT ...]
UNION is used to combine the result from multiple SELECT statements into a single result set.
The column names from the first SELECT statement are used as the column names for the results returned. Selected columns listed in corresponding positions of each SELECT statement should have the same data type. (For example, the first column selected by the first statement should have the same type as the first column selected by the other statements.)
热心网友 时间:2022-06-18 16:48
select +“需要显示的字段”+from sms3 as a inner join diary as b on a. DEPT_NAME=b.DEPT_NAME where +"加上自己的查询条件"