Bmid Bmmc
1 college of
2 surgical
(2) : items information table cp for column names are: CPXH (item ID: numeric (primary key), CPMC (item name: character), CPGG (specification: character), jj (purchase price: numeric);
Cpxh CPMC Cpgg JJ
Printers, EPSON 1-300-3450
2 computer HP500 3500
(3) : inventory table cc, column names are: bmid (department ID: character), CPXH (item ID: numeric), KCSL (quantity: numeric);
Bmid Cpxh Kcsl
W2 1 5
1 2 7
5 3 3
5 3 1
Use SQL statements to find out in [inventory table] total purchase price of the highest items;
Pray god urgent
CodePudding user response:
Select * from top 1(select cp. CPMC, cp CPGG, cc. CPXH, cc. KCSL, cp. Jj, cc. KCSL * cp in jj as total amount from cc left join cp on cp. CPXH=cc. CPXH) total amount of the order by a desc
Try to see can do not
CodePudding user response:
Draw in excel as a result,CodePudding user response:
Select * from top 1(select cp. CPMC, cp CPGG, cc. CPXH, cc. KCSL, cp. Jj, cc. KCSL * cp in jj as total amount from cc left join cp on cp. CPXH=cc. CPXH) a order by desc total amount