FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » sql how to have the total rows number in this case (this is correct question)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: sql how to have the total rows number in this case (this is correct question) [message #182515 is a reply to message #182514] Fri, 09 August 2013 17:31 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 8/9/2013 10:39 AM, nawfer wrote:
> Il Fri, 9 Aug 2013 16:32:35 +0200, nawfer ha scritto:
>
>> in this select
>> $query="SELECT *
>> FROM table1
>> ORDER BY
>> (CASE WHEN column2 = 100 THEN 1 ELSE 0 END + CASE WHEN column3='Y' THEN
>> 2 ELSE 0 END) ASC, column1 ASC, column2 ASC;
>>
>>
>> how to have
>> a) the numeration for every row;
>> b) the total number of all the rows
>> c) the total number of column2 = 100 rows
>> d) the total number of column3='Y' rows
>
>
> pheraps tips is 'simple' add for every case some i++ x++ z++?
> i++ for row normal
> x++ for case WHEN column2 = 100
> z++ for case WHEN column3 = y ?
>

Why are you asking SQL questions in PHP newsgroups? You should be
asking in a newsgroup for SQL or, more preferably, one for the database
you're using.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: sql how to have the total rows number in this case nawfer
Next Topic: Re: Counter reset or not? UPDATE
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 19:37:24 GMT 2024

Total time taken to generate the page: 0.06244 seconds