First keyword in Access any comparable keyword in SQLServer 
Author Message
 First keyword in Access any comparable keyword in SQLServer

This will work better...

SELECT TOP 1 CODE, First(AT) AS FirstOfAT
 FROM Mydata

Tim McCarthy, MCSD

Quote:

>Nandan,

>Will the following work for you:

>SELECT CODE, MIN(AT) AS FirstOfAT
>FROM Mydata
>GROUP BY CODE



>> Hi,

>> I am trying to convert from Access a SQL statement
>> similar to the one below to SQL Server. Since T-SQL
>> does not have a  'first' keyword is there anything similar
>> similar I can use.

>> Thanks
>> Nandan

>> Access Statement.

>> SELECT CODE, First(AT) AS FirstOfAT
>> FROM Mydata
>> GROUP BY CODE;



Fri, 15 Mar 2002 03:00:00 GMT
 First keyword in Access any comparable keyword in SQLServer

I don't thing is that the solution Nandan is searching for, because he wants
to return a row per CODE, not a row in total,

If he wants to retrieve the first record, not the minimum one as BPMargolin
example, he can do something like this:

SELECT DISTINCT CODE,
    (SELECT TOP 1 AT
    FROM Mydata m2
    WHERE m2.code = m1.code) AS FirstOfAT
  FROM Mydata m1

--
Fernando G. Guerrero
MCDBA, MCSD, MCT, MCSE+Internet
QA Group Ltd., UK


Quote:
> This will work better...

> SELECT TOP 1 CODE, First(AT) AS FirstOfAT
>  FROM Mydata

> Tim McCarthy, MCSD


> >Nandan,

> >Will the following work for you:

> >SELECT CODE, MIN(AT) AS FirstOfAT
> >FROM Mydata
> >GROUP BY CODE



> >> Hi,

> >> I am trying to convert from Access a SQL statement
> >> similar to the one below to SQL Server. Since T-SQL
> >> does not have a  'first' keyword is there anything similar
> >> similar I can use.

> >> Thanks
> >> Nandan

> >> Access Statement.

> >> SELECT CODE, First(AT) AS FirstOfAT
> >> FROM Mydata
> >> GROUP BY CODE;



Fri, 15 Mar 2002 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Access to SQL Server 7 Query conversion with FIRST Keyword

2. keyword "NAME" not reserved keyword

3. First Keyword

4. Searcing by keywords in SQLSERVER 6.5

5. Using the JOIN keyword in SQLServer Quert Ananyzer

6. Access / ANSI SQL - Help with Comparitive keywords

7. SQL Keyword Combinations using dao with Access

8. Searching For Keywords Using Vb6 and Access???

9. Comparison of ANSI SQL and Access SQL keywords

10. Access Validation Rule - Like Keyword problem

11. Patch to make pg_hba.conf handle virtualhost access control and samehost keyword

12. Comparison of ANSI SQL and Access SQL keywords


 
Powered by phpBB® Forum Software