Importing CSV into MySQL

2009-09-16 Thread Tim Thorburn
Hi, I'm sure I'm missing something quite obvious here, but the caffeine hasn't quite kicked in yet. As the subject says, I'm importing a csv file into MySQL 5.1.36 on WinXP using phpMyAdmin 3.3.2 (Apache 2.2.11 and PHP 5.3.0 should it matter). I've done this many times, however I'm now

Datediff function

2009-09-16 Thread John Meyer
I'm trying to pull up a list of users who haven't tweeted in 7 or more days, and I'm trying to use this statement: SELECT USER_NAME, MAX(TWEET_CREATEDAT) FROM USERS NATURAL JOIN TWEETS WHERE DATEDIFF(NOW(),MAX(TWEET_CREATEDAT)) 7 GROUP BY USERS.USER_ID But it says invalid group function. How

Problem with MySQL user

2009-09-16 Thread John Oliver
I'm working with two VMs, one a web server, one a MySQL database server. In mysql, I added a 'user'@'172.16.1.2' with privileges appropriate for the web site, and that works. The VMs got shipped off to a hosting facility. They got the 172.16.1.X network between the two VMs up, but when they try to

RE: Importing CSV into MySQL

2009-09-16 Thread Gavin Towey
Hi Tim, Try using LOAD DATA INFILE from the mysql CLI. PMA can often introduce unexpected behavior for export/import. Regards, Gavin Towey -Original Message- From: Tim Thorburn [mailto:webmas...@athydro.com] Sent: Wednesday, September 16, 2009 7:14 AM To: mysql@lists.mysql.com

RE: Datediff function

2009-09-16 Thread Gavin Towey
Hi John, You can't use aggregate function in the WHERE clause, because they aren't evaluated until after the WHERE clause is applied. Wouldn't it be much easier to simply keep a last_tweet_date field updated somewhere then simply do SELECT USER_NAME FROM USERS WHERE last_tweet_date

RE: Problem with MySQL user

2009-09-16 Thread Gavin Towey
Hi John, You can turn of name resolution by adding skip-name-resolve to the [mysqld] section of your my.cnf file. Regards, Gavin Towey -Original Message- From: John Oliver [mailto:joli...@john-oliver.net] Sent: Wednesday, September 16, 2009 4:24 PM To: mysql@lists.mysql.com Subject:

Re: Datediff function

2009-09-16 Thread John Meyer
Gavin Towey wrote: Hi John, You can't use aggregate function in the WHERE clause, because they aren't evaluated until after the WHERE clause is applied. Wouldn't it be much easier to simply keep a last_tweet_date field updated somewhere then simply do SELECT USER_NAME FROM USERS WHERE

What should it be in MySql? In C, it's an array of integers.

2009-09-16 Thread Pete Wilson
Hi folks -- What would be the right approach in MySql 5.0? My table, USERS, has columns NAME and IP. Associated with each user is also a collection of from 0 to 50 INTs. What's a reasonable way to put these 50 INTs in the table without using 50 separate columns, INT01...INT50? Is BLOB an OK

Re: What should it be in MySql? In C, it's an array of integers.

2009-09-16 Thread John Meyer
Pete Wilson wrote: Hi folks -- What would be the right approach in MySql 5.0? My table, USERS, has columns NAME and IP. Associated with each user is also a collection of from 0 to 50 INTs. What's a reasonable way to put these 50 INTs in the table without using 50 separate columns,

Re: What should it be in MySql? In C, it's an array of integers.

2009-09-16 Thread Kyong Kim
Be careful about burying list type of data in a column. I've seen poor performance issues parsing lists and XML type data buried in columns. A lot depends on your application and how and what you need to query from those lists. I've seen a case where a submitted documents were stored in a column

Re: What should it be in MySql? In C, it's an array of integers.

2009-09-16 Thread Pete Wilson
Pete wrote: Hi folks -- What would be the right approach in MySql 5.0? My table, USERS, has columns NAME and IP. Associated with each user is also a collection of from 0 to 50 INTs. What's a reasonable way to put these 50 INTs in the table without using 50 separate columns,

Re: What should it be in MySql? In C, it's an array of integers.

2009-09-16 Thread John Meyer
Pete Wilson wrote: Break them out into a separate table linked via the primary key. How elegant! Thanks. -- Pete it's nothing not taught in Database Design 101. Typically you would have a setup like this USERS USER_ID --primary key USER_NAME USER_IP ASSOC_NUMBERS A_ID