继承我的SQL代码
SELECT system.name, ceil(sum(((comp.price*1.3)/100)))*100-1 Computed_value, 'total_price' as type
FROM Computersystem system, component comp
WHERE system.name='Corporal' AND
((comp.name = gpu) OR
(comp.name = cpu) OR
(comp.name = ram) OR
(comp.name = mainboard) OR
(comp.name = computercase))
GROUP BY system.name
UNION
SELECT system.name, min(currentStock) minCurrent, 'minCurrent' as type
FROM stock st, Computersystem system
WHERE system.name='Corporal' AND
((st.name = gpu) OR
(st.name = cpu) OR
(st.name = ram) OR
(st.name = mainboard) OR
(st.name = computercase))
GROUP BY system.name;
哪个输出
现在想要获得一个包含以下行的表:
____Name_____Total Price______minCurrent____
我有办法做到这一点吗?
答案 0 :(得分:0)
如果我有正确的问题,查询就像(在UNION之上)
<html>
<head>
<meta charset="utf-8">
<title>CS230 Assignment 3</title>
<link rel="stylesheet" href="style1.css" type="text/css" media="all" />
<script src="myjs.js" type="text/javascript"></script>
</head>
<body>
<h3>Diary:</h3>
<form action="insert.php" method="post">
<div id="table">
<table>
<tr>
<th>When/Where</th>
<th>Event</th>
<th>Emotion</th>
<th>Automatic Thoughts</th>
<th>Rational Response</th>
</tr>
<tr>
<td><input type="text" style="height:500px;" name="in1" id="in1"></td>
<td><input type="text" style="height:500px;" name="in2" id="in2"></td>
<td><input type="text" style="height:500px;" name="in3" id="in3"></td>
<td><input type="text" style="height:500px;" name="in4" id="in4"></td>
<td><input type="text" style="height:500px;" name="in5" id="in5"></td>
</tr>
</table>
</div>
<div id="buttons">
<input type="submit" name="save" id="save" value="Save Entry" onclick="saved()">
</div>
</form>
<div id="clearButton">
<button id="clear" onClick="clear();">clear</button>
</div>
<form action="show.php" method="post">
<input type="submit" name="show" id="show" value="Show Diary">
</form>
</body>
</html>