this should work:
select NAME, sum(if(IF_PURCHASED='true',COUNT,0)),
sum(if(IF_PURCHASED='false', COUNT,0)) from TABLENAME group by NAME;
eva
-Original Message-
From: cengiz "taţhan [mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2003 9:29 AM
To: [EMAIL PROTECTED]
Subject: Can I do
ion.co.uk> cc: <[EMAIL PROTECTED]>
Subject: Re: can i do this
with sql?
ns" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 1:24 PM
Subject: Re: can i do this with sql?
>
>
> i belive you want..:
>
> SELECT * FROM your_table WHERE id < 9 ORDER BY id LIMIT 9;
>
> But when it comes to generating missing
i belive you want..:
SELECT * FROM your_table WHERE id < 9 ORDER BY id LIMIT 9;
But when it comes to generating missing items... I'm not sure if
i got you right though, but they should exist. MySQL cannot
make the rows that do not exist
Jamie Burns wrote:
: Hi all,
:
: I have a table like
Hi Carlos,
>SELECT * FROM some_table WHERE field1 = 1 AND field2 > 0
>ORDER BY CONCAT(field1,field2) LIMIT 1
You have to give the concatenated field an alias name and use it in the
SELECT-subpart of your query, e.g.
SELECT field1, field2, concat(field1,field2) AS sortvar1 WHERE field1=1 AND
fi
Try:
SELECT *,
CONCAT(field1,field2) as newField
FROM some_table
WHERE field1 = 1 AND field2 > 0
ORDER BY newField LIMIT 1
I don't have access to my server right now but this SHOULD work.
HTH,
Cal
- Original Message -
From: "Carlos Savoretti" <[EMAIL PROTECTED]>
To: <
I think that you can not concat and ORDER BY? (or ORDER by a function).
Hope this help
Simon
-Original Message-
From: Carlos Savoretti [mailto:[EMAIL PROTECTED]]
Sent: 24 May 2001 15:53
To: [EMAIL PROTECTED]
Subject: Can I do this ?
I'm using C API to access MySQL from another database
no.
You can do:
SELECT sum(length(Something)) FROM MyDB WHERE MyDB.Something LIKE 'this%'
But you will have to specify that for each field you want...then add them
all up to get the length.
Cal
http://www.calevans.com
-Original Message-
From: Jason Terry [mailto:[EMAIL PROTECTED]]
Se