Hi,
    Thanks for the reply. The main aim is to select the first record or
the last record. Is there any direct command for these. Please help me
in this.

Thanks,
Narasimha



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 01, 2004 7:30 PM
To: [EMAIL PROTECTED]
Subject: RE: Reg SubQuery
Importance: High

Or.. Select * from emp order by id asc limit 0,1 if you want to  fetch
all details.

-----Original Message-----
From: Jason McKnight [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 01, 2004 7:21 PM
To: [EMAIL PROTECTED]
Subject: Re: Reg SubQuery

You could also do it like this:

select min(id) from emp;


Roger Baklund wrote:

> [EMAIL PROTECTED] wrote:
>
>> I need to get all the details of an employee whose salary is the
lowest.
>> I can do like this in Oracle
>>
>>
>> select * from emp where id = (select min(id) from emp).
>>
>>
>> Can we have any alternative in MySQL for the above query, as sub
>> queries are not supported in MySQL 4.0.21
>
>
> There is no need for a subquery in this case:
>
> select * from emp order by id limit 1;
>


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]




Confidentiality Notice

The information contained in this electronic message and any attachments to 
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or 
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to