> Hello everyone, > > I have the following select statement > > SELECT DISTINCT sessionID, userID, date, time > FROM sti_tracking > WHERE userID = 999 > > What I want is to have only records with the userID of 99 and where the > sessionID is distinct (meaning only on of each session id). Neither > sessionID nor userID are keys or unique. > > Obviously this isn't working. > > Can someone suggest how this should be done? > > Tim Winters > Creative Development Manager > Sampling Technologies Incorporated Had a similar experience, and I've been doing it long enough to know better. 'DISTINCT' would work only if "date" and "time" returned the same values.
Are '999' and '99' supposed to be the same? Let me see if I can rephrase what you are looking for: a. For user '999' give me the information where there is only one record with a given SessionID? b. For user '999' for each sessionID give me the unique Date and Time values. c. something else entirely. Also, are you running this in a procedureal language (e.g., perl, java)? This will give us other options. William R. Mussatto, Senior Systems Engineer Ph. 909-920-9154 ext. 27 FAX. 909-608-7061 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]