回复 楼主 bjp_zhj
var
s: string;
begin
s:='select top 10 C_code as ''商品编号'', C_name as ''商品名称'',c_price as ''单价'''+Char(#13)+
'from T_dia_spxx'+char(#13)+
'where c_code in ('+char(#13)+
'
Select distinct c_code from T_dia_spxx'+char(#13)+
'
)';
MessageBox(0, PChar(s), '执行以下SQL查询不重复的前10个商品信息', MB_OK);
with qry1 do
begin
close;
SQL.Clear;
sql.Add(s);
open;
end;
end;