好的,我很新,SQL所以这里的问题是:
对于已下订单的每个salesrep,列出所有订单的最小,最大和平均订单金额.仅包括1990 - 1999年间任何时候发出的订单.从列表中省略任何仅在此时间范围内生成1个订单的salesrep.按Salesrep编号对结果进行排序.
我把它归结为:
SELECT Rep
,MIN(Amount) AS "MinAmount"
,MAX(Amount) AS "MaxAmount"
,AVG(Amount) AS "AverageAmount"
FROM Orders
WHERE Orderdate BETWEEN '1990-01-01' AND '1999-12-31'
GROUP BY Rep;
Run Code Online (Sandbox Code Playgroud)
我以为anwser是:
AND Rep > ( SELECT COUNT(Distinct Rep)
FROM Orders)
Run Code Online (Sandbox Code Playgroud)
但它似乎没有用.任何帮助都很感激!
最后订单包含:
CREATE TABLE Orders
(OrderNum NUMBER(10) NOT NULL,
OrderDate DATE NOT NULL,
Cust NUMBER(10),
Rep NUMBER(10),
Mfr CHAR(3) NOT NULL,
Product CHAR(5) NOT NULL,
Qty NUMBER(5) NOT NULL,
Amount NUMBER(9,2) NOT NULL,
CONSTRAINT OrdersPK
PRIMARY KEY (OrderNum));
Run Code Online (Sandbox Code Playgroud) 从来没有在这里发布,但我不知道为什么它不使用此代码,但在另一个工作.哦,在使用BlueJ,它说的calcButton.addActionListener(handler);是错误.
public class JoesAutoGUI extends JPanel
{
protected RoutineService routineServices;
protected NonroutineService nonroutineServices;
protected SummaryPanel summarypanel;
protected JTabbedPane tabbs;
protected JPanel title;
protected JPanel charges;
protected JPanel summary;
protected JPanel buttonPanel;
protected JLabel titlePanel;
protected JButton calcButton;
protected JButton exitButton;
protected ImageIcon car;
public JoesAutoGUI()
{
//setLayout(new BorderLayout());
tabbs = new JTabbedPane(JTabbedPane.TOP);
buildButtonPanel();
buildTitlePanel();
JPanel charges = new JPanel();
tabbs.addTab("Charges", null, charges, "Charges calculator");
charges.setLayout(new BorderLayout() );
charges.add(titlePanel, BorderLayout.NORTH);
charges.add( routineServices = new RoutineService(), BorderLayout.WEST);
charges.add(nonroutineServices …Run Code Online (Sandbox Code Playgroud)