Home > database >  The great god help me translate this SQL detailed
The great god help me translate this SQL detailed

Time:09-30

SELECT *
The FROM (
The SELECT tmp_page. *, rownum AS row_id
The FROM (
The SELECT of al-qeada roup_id, a.h os_id, a.c opy_code, Anderson nv_id, Anderson nv_no
And Anderson, nv_code, Anderson nv_name, arjun at_type_id, b.m at_type_name, Anderson nv_model
, Anderson s_com, a.u nit_code, c.u nit_name, aa. Sup_id, d.s up_no
, d.s up_name, a.f ac_id, e.f ac_no, e.f ac_name, Amy polumbo lan_price
, a.s ell_price, f.p ack_code, g.p ack_name, f. may ap_amount AS num_exchange, a.a lias
., aa is_default
The FROM mat_inv_dict a
LEFT the JOIN mat_type_dict ON al-qeada roup_id b=b.g roup_id
AND a.h os_id=b.h os_id
AND a.c opy_code=biggest opy_code
AND arjun at_type_id=b.m at_type_id
AND arjun at_type_no=b.m at_type_no
AND b.i s_stop=0
Be sad roup_id chtistina georgina rossetti.british poetess LEFT JOIN ON al-qeada roup_id hos_unit c=
AND a.h os_id=c. os_id
AND a.u nit_code=c.u nit_code
LEFT the JOIN (
SELECT sup_id inv_id, group_id, hos_id copy_code
, is_default
The FROM mat_inv_sup
WHERE group_id='101'
AND hos_id='105'
AND copy_code='wuliu'
AND is_default=1
) aa ON al-qeada roup_id=aa. Group_id
AND a.h os_id=aa. Hos_id
AND a.c opy_code=aa. Copy_code
AND Anderson, nv_id=aa. Inv_id
LEFT the JOIN hos_sup_dict d ON aa. Group_id=d.g roup_id
AND aa. Hos_id=d.h. os_id
AND aa. Sup_id=d.s up_id
AND d.i s_stop=0
LEFT JOIN hos_fac_dict ON al-qeada roup_id=e um participant roup_id
AND a.h os_id=e.h os_id
AND a.f ac_id=e.f ac_id
AND e.i s_stop=0
LEFT the JOIN mat_inv_unit_map f ON f.i nv_id=Anderson nv_id
AND f.h os_id=a.h os_id
AND f.g roup_id=al-qeada roup_id
AND f. opy_code=a.c opy_code
LEFT the JOIN hos_package g ON f.g roup_id=g.g roup_id
AND f.h os_id=we os_id
AND f.p ack_code=g.p ack_code
WHERE al-qeada roup_id='101'
AND a.h os_id='105'
AND a.c opy_code='wuliu'
AND Anderson, s_stop=0
AND a.u se_state=1
The ORDER BY Anderson nv_code
) tmp_page
WHERE rownum & lt;=20
)
WHERE row_id & gt; 0

CodePudding user response:

Long ah, look not to come over, who also don't know the meaning of your business

CodePudding user response:

Advice from the layer, then is too long,,,,,,,

CodePudding user response:

 SELECT * 
The FROM (SELECT TMP_PAGE. *, ROWNUM AS ROW_ID - ROWNUM ORACLE default column
The FROM (
The SELECT of al-qeada ROUP_ID,
A.H OS_ID,
A.C OPY_CODE,
Anderson NV_ID,
Anderson NV_NO,
Anderson NV_CODE,
Anderson NV_NAME,
Arjun AT_TYPE_ID,
B.M AT_TYPE_NAME,
Anderson NV_MODEL,
Anderson S_COM,
A.U NIT_CODE,
C.U NIT_NAME,
AA SUP_ID,
D.S UP_NO,
D.S UP_NAME,
A.F AC_ID,
E.F AC_NO,
E.F AC_NAME,
Amy polumbo LAN_PRICE,
A.S ELL_PRICE,
F.P ACK_CODE,
G.P ACK_NAME,
F. may AP_AMOUNT AS NUM_EXCHANGE,
A.A LIAS,
AA. IS_DEFAULT
The FROM MAT_INV_DICT A
LEFT the JOIN MAT_TYPE_DICT B
ON al-qeada ROUP_ID=B.G ROUP_ID - according to the associated conditions A left join B
AND A.H OS_ID=B.H OS_ID
AND A.C OPY_CODE=biggest OPY_CODE
AND arjun AT_TYPE_ID=B.M AT_TYPE_ID
AND arjun AT_TYPE_NO=B.M AT_TYPE_NO
AND B.I S_STOP=0
LEFT the JOIN HOS_UNIT C - according to the associated conditions A LEFT JOIN C
Be sad ROUP_ID chtistina georgina rossetti.british poetess ON al-qeada ROUP_ID=
AND A.H OS_ID=c. OS_ID
AND A.U NIT_CODE=C.U NIT_CODE
LEFT the JOIN (SELECT SUP_ID,
INV_ID,
GROUP_ID,
HOS_ID,
COPY_CODE,
IS_DEFAULT
The FROM MAT_INV_SUP
WHERE GROUP_ID='101'
AND HOS_ID='105'
AND COPY_CODE='wuliu'
AND IS_DEFAULT=1) AA
ON al-qeada ROUP_ID=AA. GROUP_ID -- -- according to the associated conditions A left join AA (sub-queries)
AND A.H OS_ID=AA. HOS_ID
AND A.C OPY_CODE=AA. COPY_CODE
AND Anderson, NV_ID=AA. INV_ID
LEFT the JOIN HOS_SUP_DICT D
ON AA. GROUP_ID=D.G ROUP_ID AA - according to the associated conditions left join D
AND AA. HOS_ID=d.h. OS_ID
AND AA. SUP_ID=D.S UP_ID
AND D.I S_STOP=0
LEFT the JOIN HOS_FAC_DICT E
ON al-qeada ROUP_ID=um participant ROUP_ID - according to the associated conditions A left join E
AND A.H OS_ID=E.H OS_ID
AND A.F AC_ID=E.F AC_ID
AND E.I S_STOP=0
LEFT the JOIN MAT_INV_UNIT_MAP F
ON F.I NV_ID=Anderson NV_ID - according to the associated conditions A left join F
AND F.H OS_ID=A.H OS_ID
AND F.G ROUP_ID=al-qeada ROUP_ID
AND f. OPY_CODE=A.C OPY_CODE
LEFT the JOIN HOS_PACKAGE G
ON F.G ROUP_ID=G.G ROUP_ID - according to the associated conditions F left join G
AND F.H OS_ID=we OS_ID
AND F.P ACK_CODE=G.P ACK_CODE
WHERE al-qeada ROUP_ID='101' - A table filters
AND A.H OS_ID='105'
AND A.C OPY_CODE='wuliu'
AND Anderson, S_STOP=0
AND A.U SE_STATE=1
The ORDER BY Anderson NV_CODE) TMP_PAGE
WHERE ROWNUM & lt;=20)
WHERE ROW_ID & gt; 0

/* in turn in A table for "the main table" left associated
A LEFT JOIN B
A LEFT JOIN C
A LEFT JOIN (AA LEFT JOIN D)
A LEFT JOIN E
A LEFT JOIN (F LEFT JOIN G)
Put these a clearance joint is a whole
Take 20 data before */

CodePudding user response:

From the inside of the outer query results query table, in turn, outward very basic query, building the view is so complex, understanding and easy points,

CodePudding user response:

Longer,, it looks more troublesome, is actually from the innermost layer began to read
  • Related