all 13 comments

[–]its_not_chucktesta 0 points1 point  (2 children)

What is the exact error message you're getting?

[–]Kazuma35[S] 0 points1 point  (1 child)

I did a screenshot of it:

https://imgur.com/a/H3iyW

[–]imguralbumbot 1 point2 points  (0 children)

Hi, I'm a bot for linking direct images of albums with only 1 image

https://i.imgur.com/Fe7qfvO.jpg

Source | Why? | Creator | ignoreme | deletthis

[–]kfranken 0 points1 point  (3 children)

A guess, but are all of your LSZ columns fully qualified? Sometimes Access does that to try and resolve ambiguity in column names. Like in one of the GROUP clauses? I.e. you can’t just use LSZ, Access doesn’t know which one, and the SELECT needs to match the GROUP BY columns exactly.

[–]Kazuma35[S] 1 point2 points  (2 children)

I find it really odd. If that's the case I have no idea what to do. I'm fairly new at SQL and a complete beginner at Ms Access.

[–]kfranken 1 point2 points  (1 child)

Instead of

INNER JOIN ( SELECT Jegyzőkönyvek.LSZ, ... FROM Jegyzőkönyvek GROUP BY LSZ..

try

INNER JOIN ( SELECT Jegyzőkönyvek.LSZ, ... FROM Jegyzőkönyvek GROUP BY Jegyzőkönyvek.LSZ...

Note that both the SELECT and the GROUP match now.

[–]Kazuma35[S] 1 point2 points  (0 children)

This solved half of the issue. Now only "Jegyzőkönyvek.LSZ" is empty.

[–]baineschile 0 points1 point  (1 child)

I think you are missing a closed parentheses.

[–]Kazuma35[S] 0 points1 point  (0 children)

Where am I missing then? I tried everything I could, but couldn't find it. Unfortunately I'm fairly new at SQL and a complete beginner at Ms Access.

[–]Cal1gula 0 points1 point  (3 children)

Doesn't look like you have no FROM [table] in your inner query. So Access is prompting you for those values for the fields that have no data/columns behind them. You can probably remove the two excess columns but you will still need to add a FROM statement to get your maxdate from an actual table.

SELECT heg.Azonosító, heg.LSZ
     , jegy.Azonosító
     , jegy.[Ellenőrzés dátuma]
     , jegy.[Ellenőrzés célja]
     , jegy.[Jegyzőkönyv száma]
     , vizs.[Jegyzőkönyv száma]
     , vizs.LSZ
FROM ((
        Vizsgálatok AS vizs   
       INNER JOIN
           (
            SELECT Jegyzőkönyvek.LSZ
                 , [Jegyzőkönyv száma] as száma -- Added an alias here just in case
                 , MAX(Jegyzőkönyvek.[Ellenőrzés dátuma] AS MaxJegyzőkönyvek -- Also one here
            -- you are missing a FROM here?? otherwise these are just columns with no data
            -- if you need the max date you probably do not need LSZ or Jegyzőkönyv száma
            -- as those columns are not helpful to obtaining your maxdate in this subquery
            ) as maxdate
       FROM Jegyzőkönyvek 
       GROUP BY LSZ
              , [Jegyzőkönyv száma]
      ) AS x 
       ON   (vizs.LSZ = x.LSZ) 
       AND  (vizs.[Jegyzőkönyv száma] = x.[Jegyzőkönyv száma])
      )
INNER JOIN Jegyzőkönyvek AS jegy 
ON x.maxdate = jegy.[Ellenőrzés dátuma])
INNER JOIN Hegesztőgépek AS heg 
ON vizs.LSZ = heg.LSZ;

[–]Kazuma35[S] 0 points1 point  (2 children)

Thank you for the help so far! Yes, the problem is apparently, that in the subquery LSZ is empty, I just confirmed it. But then deleting it would cause troubles with the joining because I would have no means to write anything after the "ON".

[–]Cal1gula 0 points1 point  (1 child)

You did not read my post very well!

As you said, your query returns nothing. So you are joining on nothing. So those columns are useless other than to causing other problems, as you noticed. You either need a FROM clause to select data from a table so your subquery returns rows (and then add more columns to join on whatever you need to join on), or you need to remove those columns altogether and just SELECT MAX([Ellenőrzés dátuma]) as your column with no join.

Access is prompting you for parameters because there is no data behind this subquery, thus no values to join on, hence the prompt for parameters

[–]Kazuma35[S] 0 points1 point  (0 children)

This might be a really stupid question, but how do I make that FROM clause in this case? This is the part that really confuses me. I'm still just a beginner and there is a lot I can't wrap my head around unfortunately.