| Код | object Form1: TForm1 Left = 192 Top = 109 Width = 870 Height = 169 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object DBGrid1: TDBGrid Left = 304 Top = 0 Width = 537 Height = 129 DataSource = DataSource1 TabOrder = 0 TitleFont.Charset = DEFAULT_CHARSET TitleFont.Color = clWindowText TitleFont.Height = -11 TitleFont.Name = 'MS Sans Serif' TitleFont.Style = [] end object ADOConnection1: TADOConnection Connected = True ConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Test.mdb;Mode=ReadW' + 'rite;Persist Security Info=False' LoginPrompt = False Mode = cmReadWrite Provider = 'Microsoft.Jet.OLEDB.4.0' Left = 64 Top = 32 end object ADOQuery1: TADOQuery Active = True Connection = ADOConnection1 CursorType = ctStatic Parameters = <> SQL.Strings = ( 'SELECT Sum(ProjestList.ProjectPrice) AS [Sum-ProjectPrice], Sum(' + 'CurrentMaker.ProjectSalary) AS [Sum-ProjectSalary], Sum([Projest' + 'List]![ProjectPrice]-[CurrentMaker]![ProjectSalary]) AS asdas, [' + 'MonthName]![NameMonth] & "-" & [ProjestList]![ProjectYear] AS '#1042#1099 + #1088#1072#1078#1077#1085#1080#1077'1, CurrentStatus.NameStatus' 'FROM (MonthName INNER JOIN (CurrentStatus INNER JOIN ProjestList' + ' ON CurrentStatus.CodeStatus=ProjestList.CurrentStatus) ON Month' + 'Name.CodeMonth=ProjestList.CodeMonth) INNER JOIN (Makers INNER J' + 'OIN CurrentMaker ON Makers.CodeMaker=CurrentMaker.CodeMaker) ON ' + 'ProjestList.CodeList=CurrentMaker.CodeProject' 'GROUP BY [MonthName]![NameMonth] & "-" & [ProjestList]![ProjectY' + 'ear], CurrentStatus.NameStatus, ProjestList.ProjectYear' 'HAVING (((CurrentStatus.NameStatus) Like "*" & "asd" & "*") AND ' + '((ProjestList.ProjectYear)=2007));') Left = 120 Top = 32 end object DataSource1: TDataSource DataSet = ADOQuery1 Left = 176 Top = 32 end end
|
сам запрос
| Код | SELECT Sum(ProjestList.ProjectPrice) AS [Sum-ProjectPrice], Sum(CurrentMaker.ProjectSalary) AS [Sum-ProjectSalary], Sum([ProjestList]![ProjectPrice]-[CurrentMaker]![ProjectSalary]) AS asdas, [MonthName]![NameMonth] & "-" & [ProjestList]![ProjectYear] AS Выражение1, CurrentStatus.NameStatus FROM (MonthName INNER JOIN (CurrentStatus INNER JOIN ProjestList ON CurrentStatus.CodeStatus=ProjestList.CurrentStatus) ON Month Name.CodeMonth=ProjestList.CodeMonth) INNER JOIN (Makers INNER JOIN CurrentMaker ON Makers.CodeMaker=CurrentMaker.CodeMaker) ON ProjestList.CodeList=CurrentMaker.CodeProjectGROUP BY [MonthName]![NameMonth] & "-" & [ProjestList]![ProjectYear], CurrentStatus.NameStatus, ProjestList.ProjectYearHAVING (((CurrentStatus.NameStatus) Like "*" & "asd" & "*") AND ((ProjestList.ProjectYear)=2007));
|
|