Obtaining the first or second instance of an event
I am looking at data from a telephone call centre. I have a table giving data on calls made including time and date with the name CallDateTime. Each call has a number, CallId and each customer has a number CustomerNo. Each row represents a different call. I would like to create a column which identifies the first call made by a customer in a particular month. That is if a particular call is the first call made by that customer in that month, there is a 1 in the column, otherwise there is a zero. I would also like to identify the second call (if any) made by the customer in a particular month. I am quite inexperienced with MySQL and SQL in general and would appreciate any help which you can offer. Thanks David Scott _ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 Auckland 1142,NEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: [EMAIL PROTECTED] Graduate Officer, Department of Statistics Director of Consulting, Department of Statistics -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Stable mysql 4.xx
Hello, Where I can find the best stable version 4.xx? Greetings, Ćukasz Ciszak http://www.subasta.pl
Re: Stable mysql 4.xx
Hi, Subasta.pl - Darmowe Aukcje Internetowe wrote: Hello, Where I can find the best stable version 4.xx? Some of the mirrors still have older versions, such as http://mysql.mirrors.pair.com/ Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Obtaining the first or second instance of an event
Hi David, David Scott wrote: I am looking at data from a telephone call centre. I have a table giving data on calls made including time and date with the name CallDateTime. Each call has a number, CallId and each customer has a number CustomerNo. Each row represents a different call. I would like to create a column which identifies the first call made by a customer in a particular month. That is if a particular call is the first call made by that customer in that month, there is a 1 in the column, otherwise there is a zero. I would also like to identify the second call (if any) made by the customer in a particular month. I am quite inexperienced with MySQL and SQL in general and would appreciate any help which you can offer. There are many solutions to this type of query. I have written about some of them at http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/. For your particular query, I would start by just writing a query to find the rows, then progress to maintaining the column later. Probably something like this would do it: select calls.* from calls inner join ( select CustomerNo, min(CallDateTime) as CallDateTime from calls group by CustomerNo, left(CallDateTime, 7) ) as min_rows using(CustomerNo, CallDateTime) This may not be the most efficient way to do the query, but I think once you learn how it works you can worry about that. (Only you can do that, because you know the table structure and the kinds of queries you're doing). Finding the second call is just an extension of this technique. More is in the article I linked. cheers Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Stable mysql 4.xx
In the last episode (Jun 03), Subasta.pl - Darmowe Aukcje Internetowe said: Where I can find the best stable version 4.xx? http://dev.mysql.com/downloads/mysql/4.1.html You should really consider using MySQL 5.0, though. -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Problem with UPDATE
Hi everyone, I have a form where you fill out description from a textarea and on submit, it updates description in mytable. This works fine. I want to also add the current date into description in my table. Here's what I get: $date = date (F d Y); $sql = UPDATE mytable SET description= '$date $description' WHERE id=$id; $result = mysql_query($sql); 1st time I enter data in the form, the output is fine: Current date followed by the data. 2nd time I enter data into the form, the output is like so: Current date (from the 2nd time I filled out the form) followed by current date (from the 1st time I filled out the form) followed by 1st data then 2nd data. By putting $date after $descrption $date = date (F d Y); $sql = UPDATE mytable SET description= '$description $date ' WHERE id=$id; $result = mysql_query($sql); I get a better result: Data followed by date (1st time filling the form) Data followed by date (2nd time filling the form) Anyone know how I can get B but have the date before the data? Thanks Haig -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Stable mysql 4.xx
I'm haing a hard time figuring out why you want an old 4.0 server, when newer better versions are available. MySQL 4.0.27 can be downloaded from Softpedia: http://linux.softpedia.com/progDownload/MySQL-Download-3074.html On Mon, June 4, 2007 00:44, Baron Schwartz wrote: Only back to 4.1.x -- before that, they say it's no longer supported. I couldn't find a way to get it, anyway. Mogens Melander wrote: If i'm not mistaken, the mysql site, also has older versions. On Sun, June 3, 2007 18:31, Baron Schwartz wrote: Hi, Subasta.pl - Darmowe Aukcje Internetowe wrote: Hello, Where I can find the best stable version 4.xx? Some of the mirrors still have older versions, such as http://mysql.mirrors.pair.com/ Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean. -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean. -- Later Mogens Melander +45 40 85 71 38 +66 870 133 224 -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]