Select First(Field1) From Table1 Order By Field1

S

Stapes

Hi

I am trying to run a query in this format: -

SELECT First([FM_InvoiceImport].[Field1]) AS FirstOfField1
FROM FM_InvoiceImport ORDER BY [FM_InvoiceImport].[Field1];

It keeps telling me 'You tried to execute a query that does not
include the specified expression '[FM_InvoiceImport].[Field1]' as part
of an aggregate function.'

Why won't it work??

Stapes
 
G

Guest

SELECT First(FM_InvoiceImport.Field1) AS FirstOfField1
FROM FM_InvoiceImport;

or

SELECT First(FM_InvoiceImport.Field1) AS FirstOfField1,
FM_InvoiceImport.IDField
FROM FM_InvoiceImport
GROUP BY FM_InvoiceImport.IDField;
 
D

Douglas J. Steele

I'm not sure either of those are correct, Wayne. The problem with using
First is that unless you provide a specific sort order, you really have no
way of knowing which value will be returned. First is a pretty meaningless
concept in relational databases, since you have no idea in what order the
data is physically stored.

Stapes: Try using Min or Max instead.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Wayne-I-M said:
SELECT First(FM_InvoiceImport.Field1) AS FirstOfField1
FROM FM_InvoiceImport;

or

SELECT First(FM_InvoiceImport.Field1) AS FirstOfField1,
FM_InvoiceImport.IDField
FROM FM_InvoiceImport
GROUP BY FM_InvoiceImport.IDField;


--
Wayne
Manchester, England.



Stapes said:
Hi

I am trying to run a query in this format: -

SELECT First([FM_InvoiceImport].[Field1]) AS FirstOfField1
FROM FM_InvoiceImport ORDER BY [FM_InvoiceImport].[Field1];

It keeps telling me 'You tried to execute a query that does not
include the specified expression '[FM_InvoiceImport].[Field1]' as part
of an aggregate function.'

Why won't it work??

Stapes
 
G

Guest

I agree - but it's just the correction of the 1st post. The whole thing
makes no sense to me as you only get the 1st of each with the 1st sql and
only the 1st of the entire with the 2nd. But .... what do I know :)
I can't really give any other witho9ut more info about what Stapes is try to
get.

I am still trying to get my new DB to make me a cup of tea. Don't suppose
you have any code for this. If a machine can make a car then surely they
must be able to make a tea.

How long do you think it will be before someone posts with - his name is
Douglas not Shirley. LoL







--
Wayne
Manchester, England.



Douglas J. Steele said:
I'm not sure either of those are correct, Wayne. The problem with using
First is that unless you provide a specific sort order, you really have no
way of knowing which value will be returned. First is a pretty meaningless
concept in relational databases, since you have no idea in what order the
data is physically stored.

Stapes: Try using Min or Max instead.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Wayne-I-M said:
SELECT First(FM_InvoiceImport.Field1) AS FirstOfField1
FROM FM_InvoiceImport;

or

SELECT First(FM_InvoiceImport.Field1) AS FirstOfField1,
FM_InvoiceImport.IDField
FROM FM_InvoiceImport
GROUP BY FM_InvoiceImport.IDField;


--
Wayne
Manchester, England.



Stapes said:
Hi

I am trying to run a query in this format: -

SELECT First([FM_InvoiceImport].[Field1]) AS FirstOfField1
FROM FM_InvoiceImport ORDER BY [FM_InvoiceImport].[Field1];

It keeps telling me 'You tried to execute a query that does not
include the specified expression '[FM_InvoiceImport].[Field1]' as part
of an aggregate function.'

Why won't it work??

Stapes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top