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 #182514 is a reply to message #182513] Fri, 09 August 2013 14:39 Go to previous messageGo to previous message
nawfer is currently offline  nawfer
Messages: 34
Registered: August 2011
Karma:
Member
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 ?
[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: Sun Nov 24 00:34:17 GMT 2024

Total time taken to generate the page: 0.04050 seconds