帮我看一下SQL语句 (20分)

  • 主题发起人 主题发起人 潮州人
  • 开始时间 开始时间

潮州人

Unregistered / Unconfirmed
GUEST, unregistred user!
有三个表(客户,订单头,订单明细).现在要显示订单编号,客户名称,[产品种品(明细中的记录)]怎么样取得产品种品
我的代码这样:
SQL.Add ('select Q.*,C.CompanyName AS CustomerName,select count(*) from QuoteDetails where Q.QuoteID=QuoteDetails.QuoteID AS CountBreed from AS CountBreed from Quote as Q,Customers as C');
SQL.Add (' where Q.CustomerID=C.CustomerID order by Q.QuoteID');
提示语法错误
ado+access2000
 
大家都去哪里了,不会昨晚HAPPY得过头,忘了上班.
 
太乱了,把问题说清楚,如表结构,要求
 
补充的问题我解决了,但是存在上点问题:
//照下面的代码,如果订单没有明细那么订单头就没有显示,应该怎么解决
With MyData.QuoteADO do
begin
Close;
SQL.Clear;
SQL.Add ('select Q.*,C.CompanyName AS CustomerName, RESULT.CountBreed from Quote Q,Customers C,');
SQL.Add ('(Select a.QuoteID as QID,count(b.QuoteID) as CountBreed from Quote a,QuoteDetails b where a.QuoteID=b.QuoteID GROUP BY a.QuoteID) RESULT');
SQL.Add (' where Q.CustomerID=C.CustomerID and Q.QuoteID=RESULT.QID order by Q.QuoteID');
Open;
end;
 
access有没有left outer join?
 
当然有了,我的做过.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部