Home > database >  The combination of the three fields group query
The combination of the three fields group query

Time:10-05

ABCDEFGHIJKLM is a field name,
(A, B, C), (D, E, F), (G, H, I, J, K, L, M) take A three groups in the field name, query all the combinations

CodePudding user response:

 
Select *
The from
(select a from t
Union all
Select the from t b
Union all
Select the from c t) t1,
(select the from d t
Union all
Select the from e t
Union all
Select the from f t) t2,
The from (select g t
Union all
Select the from h t
Union all
Select the from I t
Union all
Select the from j t
Union all
Select the from k t
Union all
Select the from l t
Union all
Select m t) from t3,

CodePudding user response:

Junction post rate: 0%

reference
after your questions answered please post.
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html

8, how to give points and knot stick?
http://bbs.csdn.net/help#post_dispose

CodePudding user response:

Thanks to the attention of the teacher, I have a list of mysql feature, in the table has a field called D1, J1, Z1, L1, Y1. D2, J2, Z2, L2, Y2; D3, J3, Z3, L3, Y3, etc., I am going to put their string data according to the (D1, J1, Z1, L1, Y1), (D2, J2, Z2, L2, Y2), (D3, J3, Z3, L3, Y3) three sets of each one, together, through the query all the combination query, I am a novice, please the teacher help,

The following code is correct according to your code, the test is not successful

Select *
The from
(select from D1 feature
Union all
The select J1 from feature
Union all
Select the from the Z1 notification feature
Union all
The select L1 from feature
Union all
The select Y1 from feature) t1,
(select D2 from feature
Union all
The select J2 from feature
Union all
The select Z2 from feature
Union all
The select L2 from feature
Union all
The select Y2 from feature) t2,
The from (select D3 feature
Union all
The select J3 from feature
Union all
The select Z3 from feature
Union all
The select L3 from feature
Union all
The select Y3 from t3 feature),

CodePudding user response:

Select *
The from
(select concat (D1, J1, Z1, L1, Y1)
The from feature) as a,
(select concat (D2, J2, Z2, L2, Y2)
The from feature) as b,
(select concat (D3, J3, Z3, L3, Y3)
The from feature) as c

CodePudding user response:

What's the matter?

CodePudding user response:

Thank you for your attention, and not the stick, always say wrong wrong score 20 + 20 to 40 + 0 not 10 + 10 + 20 also wrong
  • Related