[PHP] limit 1

2001-08-24 Thread Jeremy Morano


Hi,


I wondering if it was possible to use limit on part of a query and not all.




this is my query which works the way it should.

$sql = "SELECT users.names
FROM  users, selection
Where  users.name = selection.name   and   setting = 'on' limit 1
";




What I would like to do is put a limit of 1 to only this part -> setting
= 'on' limit 1 <--- and not on the rest.

You see, there are many users.name that have a setting = 'on'I
want, ALL those names , ONLY once..

How do I do this?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] limit 1

2001-08-24 Thread ERISEN, Mehmet Kamil

This is a sql question:
Limit is limiting number of records that will come out of
query. So, it would not work.

SELECT users.names
FROM  users, selection
Where  users.name = selection.name   
and   setting =   'on' ;

you could use 
SELECT DISTINCT users.names
FROM  users, selection
Where  users.name = selection.name   
and   setting =   'on' ;

or 
SELECT users.names
FROM  users, selection
Where  users.name = selection.name   
and   setting =   'on' 
group by users.names




--- Jeremy Morano <[EMAIL PROTECTED]> wrote:
> 
> Hi,
> 
> 
> I wondering if it was possible to use limit on part of a
> query and not all.
> 
> 
> 
> 
> this is my query which works the way it should.
> 
> $sql = "SELECT users.names
>   FROM  users, selection
>   Where  users.name = selection.name   
   and   setting =
> 'on' 
>   ";
> 
> 
> 
> 
> What I would like to do is put a limit of 1 to only this
> part -> setting
> = 'on' limit 1 <--- and not on the rest.
> 
> You see, there are many users.name that have a setting =
> 'on'I
> want, ALL those names , ONLY once..
> 
> How do I do this?
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] limit 1

2001-08-24 Thread Dave

you are probably looking for unique

if not, I am not understanding what you are trying to do

Dave

>-Original Message-
>From: Jeremy Morano [mailto:[EMAIL PROTECTED]]
>
>I wondering if it was possible to use limit on part of a query and not all.
>
>this is my query which works the way it should.
>
>$sql = "SELECT users.names
>   FROM  users, selection
>   Where  users.name = selection.name   and   setting = 'on' limit 1
>   ";
>
>What I would like to do is put a limit of 1 to only this part -> setting
>= 'on' limit 1 <--- and not on the rest.
>
>You see, there are many users.name that have a setting = 'on'I
>want, ALL those names , ONLY once..
>
>How do I do this?
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]