473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

counting number of unique entries under a column

hi,
i am wanting to count the number of unique rows under a certain
column. i want to count how many times a page has been accessed. how i
plan to do this is every time a page is accessed, a session id
variable is checked for. if noe exist, a piece of code will create on.
then the session id is store in a table under one column and the pages
pre-defined number will be stored under another. so if i want to check
how many users have access a page in seperate sessions, all i need to
do is count how many unique session ids exist for that page (using the
page number - i.e. SELECT ... WHERE page_id = 8).

as i mentioned, i dont know how to count how many unique entries their
are under a column. any ideas??

also, how is it i check if a variable exists??

cheers

burnsy
Jul 17 '05 #1
2 3110

On 8-Oct-2003, bi******@yahoo.co.uk (mr_burns) wrote:
i am wanting to count the number of unique rows under a certain
column. i want to count how many times a page has been accessed. how i
plan to do this is every time a page is accessed, a session id
variable is checked for. if noe exist, a piece of code will create on.
then the session id is store in a table under one column and the pages
pre-defined number will be stored under another. so if i want to check
how many users have access a page in seperate sessions, all i need to
do is count how many unique session ids exist for that page (using the
page number - i.e. SELECT ... WHERE page_id = 8).

as i mentioned, i dont know how to count how many unique entries their
are under a column. any ideas??
assuming mysql:
$rs = mysql_query("select distinct columnname from tablename where
page_id=8") or die(mysql_error());
$num_rows = mysql_num_rows($rs);

also, how is it i check if a variable exists??


if (isset($variablename))
// $variablename exists
else
// it doesn't

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2
On 8 Oct 2003 17:09:48 -0700, bi******@yahoo.co.uk (mr_burns) wrote:
i am wanting to count the number of unique rows under a certain
column. i want to count how many times a page has been accessed. how i
plan to do this is every time a page is accessed, a session id
variable is checked for. if noe exist, a piece of code will create on.
then the session id is store in a table under one column and the pages
pre-defined number will be stored under another. so if i want to check
how many users have access a page in seperate sessions, all i need to
do is count how many unique session ids exist for that page (using the
page number - i.e. SELECT ... WHERE page_id = 8).

as i mentioned, i dont know how to count how many unique entries their
are under a column. any ideas??
SELECT COUNT(DISTINCT whatever)
FROM ...
also, how is it i check if a variable exists??


http://www.google.com/search?q=if+a+...w.php.net&l=en

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: grist2mill | last post by:
I have a table 'Group2Operation' that stores many to many relations between the 'Group' table and the 'Operation' table (each group is has permission to perform one or more of the available...
4
by: Victor Engmark | last post by:
When looking for a method to fetch unique elements and counting the number of occurences of each of them, I found quite a lot of gross examples of complex XSL. But after realizing the subtle...
1
by: windandwaves | last post by:
Hi Gurus I am trying to make a table with unique entries. Problem is, the entries are upto 1000 characters long. Can I still apply a unique index and how and if so, what field type should I...
4
by: BJ | last post by:
Can anyone tell me how to include a count of group records in a group footer. I know (I think I know!) that I have to include an unbound text box in the footer, but what expressions do I use to...
11
by: sqlservernewbie | last post by:
Hi Everyone, Here is a theoretical, and definition question for you. In databases, we have: Relation a table with columns and rows
0
meLady
by: meLady | last post by:
Hello, I have a form called feedback which has three columns and each cell in a column has a combo box that holds (Yes/No/Empty), and I want to count each column's value for example let's supposed...
1
by: RussCRM | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
2
by: srusskinyon | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
1
by: Tillu | last post by:
One of the column in a new table can be ename - varchar2(20) or hase_code_ename - number(11) – Hash Code generated by JAVA. We are going to create non-unique index on this column as one frequent...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.