union all關聯兩個不相關的表,按時間排序

2022-03-17 04:47:04 字數 893 閱讀 8066

表uc_diary與uc_photo是兩個完全不相關的表,用union all可以將這裡個表的資料關聯到一起,使用時間排序,常用於新鮮事的顯示,講日誌,相簿,說說等動態放到一起,安裝時間排序

select diary_id as

id, diary_title

astitle,

diary_text

ascontentandname,

post_time,

'diary'as

type

from

uc_diary

where

diary_state='

0'and emp_id=

'eedc8ae7-be7b-41d6-8887-283804d6aac9

'union

allselect photo_id as

id, (

select title from uc_album where album_id=uc.album_id and album_state='0

'and emp_id=

'eedc8ae7-be7b-41d6-8887-283804d6aac9

') as

title,

filename

ascontentandname,

post_time,

'photo'as

type

from

uc_photo uc

where photo_state='0

'and emp_id=

'eedc8ae7-be7b-41d6-8887-283804d6aac9

'order

by post_time desc

git使用之(五)合併兩個不相關的Git倉庫

大致是這樣的場景 有兩個倉庫,乙個git倉庫,乙個svn倉庫,都是非空的。現在要把svn倉庫中的內容合入git倉庫中,並保留提交記錄。聽起來有點奇怪,不過現實中的問題總是千奇百怪加 既然遇到了,總得想辦法解決。花了將近1個小時,簡單總結一下。按照問題的描述,問題可以演變成兩部分 合併兩個git倉庫。...

oracle insert兩個關聯表

現有一張老師學生表 tb tea cou 由於業務需要,需把老師學生表tb tea stu拆分成兩張表 tb tea tb cou 並把記錄insert到這兩張子表中 tb tea tb cou為關聯的兩張表 表結構如下 tb tea cou id,pk name,任課老師 zc,職稱 course...

oracle insert兩個關聯表

現有一張老師學生表 tb tea cou 由於業務需要,需把老師學生表tb tea stu拆分成兩張表 tb tea tb cou 並把記錄insert到這兩張子表中 tb tea tb cou為關聯的兩張表 表結構如下 tb tea cou id,pk name,任課老師 zc,職稱 course...