qClient.SQL.Clear;
qClient.SQL.Text := 'Select C.Lastname,C.Firstname,C.Clino,C.Address,' +
'C.City,C.State,C.Zip,C.Phone,C.HerCell,C.HisCell,' +
'C.Texting,C.Since,C.Selected,' +
'SUM( I.Charges - I.Discount ) as Revenue ' +
'from Client C join Invoice I ' +
'on I.Clino = C.Clino ' +
'where I.Date between :S and :E ' +
'and I.Inv = true ' +
'group by C.Clino ' +
'order by Revenue desc ';
qClient.ParamByName('S').AsDate := dStart;
qClient.ParamByName('E').AsDate := dEnd;
qClient.DetailFields := 'Clino';
qClient.Open();
How can I modify the above code so that the query includes only 'Revenue' values over a minimum (like maybe 1000)? It currently includes all clients.
Thanks, Spyke