Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10468

Re: sql how to have the total rows number in this case (this is correct question)

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php, alt.php
Subject Re: sql how to have the total rows number in this case (this is correct question)
Date 2013-08-09 13:31 -0400
Organization A noiseless patient Spider
Message-ID <ku392b$n6$1@dont-email.me> (permalink)
References <1hzfv8hshrbph$.f05cbu22em2j.dlg@40tude.net> <1ozca5e187sew.123cmqtfu0i8a$.dlg@40tude.net>

Cross-posted to 2 groups.

Show all headers | View raw


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@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

sql how to have the total rows number in this case (this is correct question) nawfer <novalidsforspam@alt.al> - 2013-08-09 16:32 +0200
  Re: sql how to have the total rows number in this case (this is correct question) nawfer <novalidsforspam@alt.al> - 2013-08-09 16:39 +0200
    Re: sql how to have the total rows number in this case (this is correct question) Jerry Stuckle <jstucklex@attglobal.net> - 2013-08-09 13:31 -0400

csiph-web