Diane
Diane

Reputation: 3

Access 2013 query - select 1st row

It seems a basic questions but after several hours and days, i'm still blocked.

As part of a query I would like to select some specific rows in a table (actually this table is already a query). As an example, rows are highlighted in the picture attached. For each "batch", this corresponds to the row containing the lower "CountofVials" and is not a "Stability rack". How would you create the query? I usually use the Design view to create query but i can understand SQL too.

table with rows to select in yellow

table with rows to select in yellow

Upvotes: 0

Views: 54

Answers (2)

Siyon DP
Siyon DP

Reputation: 514

SELECT * 
FROM YourQuery a 
WHERE EXISTS (SELECT 1  
              From YourQuery b
              WHERE b.[Stability Rack] = False AND b.Batch=a.Batch
              GROUP BY Batch
              HAVING Min(CountOfVial)=a.CountOfVial  )

Upvotes: 1

AVG
AVG

Reputation: 1462

You cannot 'select' non-contiguous in Access. You can use a form and 'highlight' entire rows or individual values using conditional formatting. There has been much posted on conditional formatting, so it would be best to just look it up.

Upvotes: 0

Related Questions