我想提取有关客户的详细信息,该客户是订购特定餐厅的最常客户 [英] i want to extract the details about the client who is the most regular customer to order a particullar restaurant

查看:41
本文介绍了我想提取有关客户的详细信息,该客户是订购特定餐厅的最常客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌子:

My tables:

NormalClient(clientNo, clientName, streetAddress, suburb, postcode, phoneNo, faxNo, contactName, joiningDate, isRegular)




School(clientNo, clientName, streetAddress, suburb, postcode, phoneNo, faxNo, contactName, joiningDate, salesTaxExNo)




PlatterOrder(orderNo, deliveryDate, deliveryTime, invoiced, isBulk, platterQuantity, discountPercent, clientNo)




SchoolOrder(orderNo, deliveryDate, deliveryTime, invoiced, taxExPercent, clientNo)




SandwichCombo(comboNo, comboName, comboPrice)




Item(name, type, retailCost, stockLevel, unit)




Supplier(supplierNo, supplierName, address, contactNo)




StoreOrder(orderNo, orderDate)




PlatterItem(orderNo, name, quantity)




SchoolCombo(orderNo, comboNo, quantity)




ComboItem(comboNo, name)




SupplierItem(supplierNo, name,currentPrice)




StoreOrderItem(supplierNo, orderNo, name, quantity, cost)





上面是我需要提取它们的表,我确实写了一个查询但是它显示错误





the above are the tables from which i need to extract them,i did write a query but it''s showing error

select clientName,streetAddress,MAX(orderNo) AS max_orders
from NormalClient N,PlatterOrder P
where N.clientNo=P.clientNo
GROUP BY orderNo ;



i这个语言的新手可能会帮助我


i am new to this language could pls help me

推荐答案

试试这个:

Try this:
select clientName, streetAddress, MAX(orderNo) AS max_orders
FROM NormalClient N INNER JOIN PlatterOrder P ON N.clientNo=P.clientNo
GROUP BY clientName, streetAddress





更多关于:

SQL联接 [ ^ ]

SQL连接的可视化表示 [ ^ ]

聚合函数 [ ^ ]



More about:
SQL Joins[^]
Visual Representation of SQL Joins[^]
Aggregate functions[^]


这篇关于我想提取有关客户的详细信息,该客户是订购特定餐厅的最常客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆