Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of taking out some Fields in Oracle Database

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Such as:

All fields in the table: the background color is the field to be taken out

Unit table: num, bm, dw_name, dw_name_pre, dw_code

Work table: name, do, check, isdel, writetime, qy_code

Where unit table dw_code = = work table qy_code

The query statement is as follows:

Select a.mom, b.* from

(

Select qy_code

To_char (writetime, 'yyyymmdd') T

Count (1) N

From work where qy_code like ('110110%')

And do = 9

And check = 9

And isdel = 0

And writetime > to_date ('2019-09-3 23 group by qy_code,' yyyy/mm/dd hh34:mi:ss') group by qy_code, to_char (writetime, 'yyyymmdd')

) a left join (select dw_name, dw_name_pre, dw_code from unit) b on a.qy_code=b.dw_code order by b.dw_name_pre, a.T asc

The data to be fetched is that the unit table has more fields, so put it on the left side of the left join.

The work table has fewer fields to fetch, so put it to the right of the letf join.

On is followed by fields associated with the two tables.

The top select a.fields, b. * from displays all the fields that have been extracted from both tables.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report