Small white to ask these questions, first two tables with parts and Labour, think through SQL statements as a result, it is concluded that the result tables which advice please, thank you,
Part table data:
Labour table data:
Want to achieve the result of the result data:
CodePudding user response:
Form the original file link: https://pan.baidu.com/s/1mDPGZyMXGw6HBwaoHD0_Zw extraction code: 3 BWH
CodePudding user response:
Select * From part Union All Select * From Labour CodePudding user response:
refer to the second floor one tree forest _ response: Select * From part Union All Select * From Labour Two table field is different, you can use the union, when I perform to the following error: Select * From tt_estimate_part Union All Select * From tt_estimate_labour 1222 - The informs The SELECT statements have a company's number of columns Time: 0.023 s CodePudding user response:
reference all6520391 reply: 3/f Quote: refer to the second floor one tree forest _ response: Select * From part Union All Select * From Labour Two table field is different, you can use the union, when I perform to the following error: Select * From tt_estimate_part Union All Select * From tt_estimate_labour 1222 - The informs The SELECT statements have a company's number of columns Time: 0.023 s You can replace * with the same field. CodePudding user response:
Hello, upstairs, I will do some of the fields, and meet a new problem, is to query the number is null, the screenshot below, how to solve? CodePudding user response:
SELECT * FROM Labour Select * from part The select A.R O_NO RO_ID, a. d. EALER_CODE, a. ABOUR_CODE, a. ABOUR_NAME, Amy polumbo RICE, A.Q TY, A.T OTP FROM Labour A The union (select DISTINCT C.R O_NO, B.R O_ID, p. ART_CODE, p. ART_NO, p. ART_NAME, p. RICE, B.Q TY, B.T OTP from part B LEFT JOIN Labour C ON B.R O_ID=C.R O_ID)