Re: assignment of data into a 2 dimensional array
| From: | Adam Williams | Date: | Mon, 03 May 2004 19:26:00 +0000 |
| Subject: | Re: assignment of data into a 2 dimensional array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185236@lists.php.net to get a copy of this message | ||
I've tried doing this in SQL, and it does not do discrete counts properly.
DISTINCT still returns each return visit by a person on the same day as a
new visit. and I just need to have it put each discrete visit into the
loop so i can count up the discrete visits
On Mon, 3 May 2004, Mattias Thorslund wrote:
> For the rest of the list I should mention that you say a "visit" is the
> same as one or more occurrences of one card number in a particular day.
>
> That could be easier done in the SQL statement... After all, this is
> the power of SQL :-)
>
> Try something along the lines of
>
> SELECT
> date,
> cardnum
> FROM
> your_table
> WHERE
> [from-to conditions]
> GROUP BY
> date, cardnum
>
> or
>
> SELECT DISTINCT
> date,
> cardnum
> FROM
> your_table
> WHERE
> [from-to conditions]
>
> Note that if you needed it, you could also get the number of card swipes
> in the former case, by adding COUNT(cardnum) as NumSwipes to the select
> clause.
>
> /Mattias
>
>