Results 1 to 4 of 4
  1. #1
    igor00082 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2023
    Posts
    1

    Упростить sql запрос

    Code:
    strSQL = "SELECT Пользователи.Телефон1, Пользователи.UserID, DMax(""[Дата публикации]"",""[Объявления] архив"",""[UserID]='"" & [UserID] & " "' и [Область]='" & Me.Комбинированная105 & "'"") AS Дата, DLookUp(""[ID]"",""[Объявления архива]"",""[UserID]='"" & [UserID] & ""' и [Дата публикации]="" & Format([Дата],""\#mm\/dd\/yyyy hh\:nn\:ss\#"") & "" и [Область]='" & Me.Комбинированная105 & "'"") AS ID, DLookUp(""[Год выпуска]"",""[Объявления архива]"",""[UserID]='"" &[UserID] & ""' и [Дата публикации]="" & Format([Дата],""\#mm\/dd\/yyyy hh\:nn\:ss\#"") & ""and [ Область]='" & Me.Комбинированная105 & "'"") AS Год" & _ 
    " ОТ Пользователи" & _
    " WHERE (((Пользователи.Телефон1) Is Null) And ((DMax(""[Дата публикации]"", ""[Объявления архива]"", ""[UserID]='"" & [UserID] & " "' and [Область]='" & Me.Комбинированная105 & "'"")) Is Not Null))" & _ 
    "ORDER BY DMax(""[Дата публикации]"",""[Объявления архива]"" ,""[UserID]='"" & [UserID] & ""' и [Область]='" & Me.Комбинированная105 & "'"") DESC "
    Уважаемые форумчане данный запрос выполняется очень долго подскажите как можно подругому написать запрос. Думаю что надо один групповой запрос на основаниии другого построить. А написать строку не получается. Подскажите как она должна быть написана. Заранее Благодарен!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Non comprende. Lo siento.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Да здравствует Украина

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Translated:-
    Dear Forums this request is executed for a very long time tell us how to write a friend request. I think that one group query should be built on the basis of another. And the line cannot be written. Tell me how it should be written. Thank you in advance!

    strSQL = "SELECT Users.Phone 1, Users.UserID, DMax("[Publication Date]",""[Announcements] Archive",""""[UserID]="" & "UserID] & " [Area]=" & Me Combined.("""[ID]","[Archive Announcements]","[UserID]='"" & [UserID] & """ and [Publication Date]="" & Format([Date]," #mm/dd /yyhy h ::nn #& "Format& and"Format([Format]" ID & "ID.("""[Year of Release]","[Archive Announcements]","[UserID]='"" &[UserID] & """ and [Date of publication]="" & Format([Date]," #mm /dd yyyyyh :nn & ") & "Date & "Format & Year" & Combined"
    " From Users" & _
    " " WHERE ((Users.Phone 1) Is Null) And (("DMax("[Publication date]"", ""[Archive Announcements]", """"[UserID]="" & [UserID] & " and [Area]" & Me.Combined 105) "Not & "Null & ")
    "ORDER BY DMax(""[Publication Date]",""[Archive Announcements]","""[UserID]='"" & [UserID] & ""' and [Scope]='" & Me.Combination.
    Last edited by mike60smart; 06-21-2023 at 01:17 PM. Reason: Add more
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums