Private Label and Cobranded VoIP Solutions
BrainCast internet & phone based message/memo recording & reminder organization system
Internet Phone Service and Broadband Phone Service by ViaTalk

Go Back   VoIP Forums, Internet Phone Service Forums, & Web Hosting Forums > CoderForums - Programming Discussion > General Programming Issues > Programming Languages & Technologies > PHP

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-06-2002, 10:58 PM
Neo Neo is offline
Registered User
 
Join Date: Dec 2001
Posts: 28
MYSQL query

I am stuck on a way of extracting unique entries from a dbase.

basically what i have is a table that holds 'users' that accessed certain 'pages' on certain 'dates'.

i want to sort by users then show last page accessed, however i have 2000+ users that access 300 different pages so i need a way to sort and extract unique entries.

e.g. sort into 'users'/'dateaccesed' and only pull the last 'page' that each user accessed into a while loop.

is there a way of calling this into a single query, then run a while loop on the result?

please help i am going nuts and the routine i have at the mo takes 43 secs for each run.
Reply With Quote
  #2  
Old 03-07-2002, 09:24 AM
top5mov top5mov is offline
Senior Customer
 
Join Date: Jun 2001
Location: Pittsburgh
Posts: 266
can you post your database structure, i.e., the names of the tables and their respective fields?
Reply With Quote
  #3  
Old 03-07-2002, 09:46 AM
Neo Neo is offline
Registered User
 
Join Date: Dec 2001
Posts: 28
hi,
my db structure is as follows

tablename:
'tracking'

fields:
'tid' [int(10)] autoincrement
'tusername' [varchar(25)]
'tip' [varchar(16)]
'tdate' [int(10)]
'tpage' [varchar(200)]

population example

1,johnp,192.168.0.23,1015506411,index.php
2,mikej,192.168.0.24,1015506413,index.php
3,mikej,192.168.0.24,1015506427,forum.php
4,mikej,192.168.0.24,1015506444,mail.php
5,johnp,192.168.0.23,1015506445,mail.php
2,carols,192.168.0.20,1015506450,index.php
6,mikej,192.168.0.24,1015506456,mail.php
7,johnp,192.168.0.23,1015506459,forum.php
8,carols,192.168.0.20,1015506467,mail.php
Reply With Quote
  #4  
Old 03-07-2002, 10:36 AM
top5mov top5mov is offline
Senior Customer
 
Join Date: Jun 2001
Location: Pittsburgh
Posts: 266
SELECT tusername, MAX(tdate) AS tdate, tip, tpage FROM tracking GROUP BY tusername
Reply With Quote
  #5  
Old 03-07-2002, 01:38 PM
Neo Neo is offline
Registered User
 
Join Date: Dec 2001
Posts: 28
That is so kewl...

thank you so much top5mov it is very much appreciated.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump