Probability Selects

2010-01-07 Thread Matt Neimeyer
I've tried Googling till my brain is fried and I'm obviously missing something because I'm not finding anything useful. I'm trying to select names at random from a table that contains the name and the frequency at which it is actually used in society. The table is defined as follows: CREATE TABLE

Bug? Distinct AS with Order By

2009-10-22 Thread Matt Neimeyer
I'm not sure what to search on to see if someone has reported this as a bug or if I'm doing something wrong... Generic code to draw a SELECT element on the screen sometimes it ends up like such... SELECT DISTINCT name AS myvalue,name AS mydisp FROM names WHERE name!="" ORDER BY myvalue On 4.1.22

VFP to MySQL Query Optimization

2009-10-20 Thread Matt Neimeyer
I feel like there should be a better way to do this... So I'm hoping someone will be able to advise. We have contacts that belong to organizations. We also have a document tracker. Holding over from VFP you can have up to six organization ids on the document and up to six contact ids. Right now th

ALTER TABLE order / optimization

2009-09-04 Thread Matt Neimeyer
Given table: CREATE TABLE testtab (d_col CHAR(4)); Question 1: It appears that there is no "harm" in just appending directives onto the alter table command even if the order doesn't make sense. It appears the parser figures it out... For example... ALTER TABLE testtab ADD COLUMN c_col char(4)

mysqldump warning or actual error?

2009-09-02 Thread Matt Neimeyer
My local windows machine has mysql 5.1.33 installed on it. One of my Mac OSX dev servers has some 4.1 flavor of MySQL on it. When I try to do something like the following: mysqldump -h devserver -u me -p somedb > dump.sql I get the following: mysqldump: Error: 'Table 'information_schema.files' d

Re: Renaming a Database

2009-08-19 Thread Matt Neimeyer
t; New York, NY 10013 > 212-625-5307 (Work) > 201-660-3221 (Cell) > AIM & Skype : RolandoLogicWorx > redwa...@logicworks.net > > -Original Message- > From: Matt Neimeyer [mailto:m...@neimeyer.org] > Sent: Wednesday, August 19, 2009 9:27 AM > To: Paul DuB

Re: Renaming a Database

2009-08-19 Thread Matt Neimeyer
>> That said... Is there anything "wrong" (dangerous, disasterous, etc) >> with stopping the MySQL service and renaming the folder in the MySQL >> data folder? By my logic (if I'm right) this should preserve any >> permissions on the folder and since the service is stopped it should >> simply find

Renaming a Database

2009-08-17 Thread Matt Neimeyer
I know the "best" way to rename a database is to use mysqldump, extract the database and then reload to the new database. (At least based on what I can find in the "12.1.32. RENAME DATABASE Syntax" section of the documentation) That said... Is there anything "wrong" (dangerous, disasterous, etc) w

Picking Collation Confusion

2009-08-14 Thread Matt Neimeyer
First off... I've read chapter 9.1.3 on character sets and collations and I'm still confused... :) (that could just be because today is Friday) Our application is installed at several different sites some running on Mac OS, some Windows and a few Linux which I suspect is what led to this situation

Converting VFP SQL to MySQL

2009-07-21 Thread Matt Neimeyer
Does anyone have any scripts that will help convert Visual FoxPro 6.0 style WHERE clauses to MySQL... For the most part the problems are converting VFP functions to the equivalent SQL. For example, Visual FoxPro has a function inlist() that is used like inlist(X,1,2,3) which converts to the MySQL

Re: Removing Duplicate Records

2009-07-14 Thread Matt Neimeyer
Ah... Yes. Good point. I like this because I was planning on keeping the output somewhere for a while. (In case we need an "accounting" at some point) So it will be easy enough to dump what's being deleted to the screen while we loop over our candidates. Thanks! On Tue, Jul 14, 2009 at 10:16 AM,

Removing Duplicate Records

2009-07-14 Thread Matt Neimeyer
In our database we have an Organizations table and a Contacts table, and a linking table that associates Contacts with Organizations. Occassionally we manually add to the linking table with information gleaned from outside data sources. This is common enough to be annoying, since it ends up with du

CONCAT with IF?

2009-07-08 Thread Matt Neimeyer
I want to store the product version that an article applies to and a comparison operator in my news system. But I can't wrap my head around the where clause... Here's what I've tried... CREATE TABLE test (version char(10), direction char(2)); select concat("6.0",direction,version) as operation f

Re: Half Hour Sub-query in MySQL vs. 5 Seconds in VFP?

2009-06-22 Thread Matt Neimeyer
On Fri, Jun 19, 2009 at 11:27 AM, Brent Baisley wrote: > It sounds like you want to use spatial indexes, but they only became > available in v4.1 > http://dev.mysql.com/doc/refman/5.0/en/create-index.html > http://dev.mysql.com/doc/refman/5.0/en/using-a-spatial-index.html That "feels" like the rig

Re: Half Hour Sub-query in MySQL vs. 5 Seconds in VFP?

2009-06-19 Thread Matt Neimeyer
>> SELECT zip FROM zipcodes WHERE >> degrees(acos(sin(radians(39.0788994))*sin(radians(latitude))+ >> cos(radians(39.0788994))*cos(radians(latitude))*cos(radians(-77.1227036-longitude*60*1.1515 >> < 5 > > Ouch.  You might want to calculate the rectange enclosing your target > distance, add an i

Half Hour Sub-query in MySQL vs. 5 Seconds in VFP?

2009-06-18 Thread Matt Neimeyer
I'm converting a PHP app from using Visual FoxPro as the database backend to using MySQL as the backend. I'm testing on MySQL 4.1.22 on Mac OSX 10.4. The end application will be deployed cross platform and to both 4.x and 5.x MySQL servers. This query returned 21 records in .27 seconds. SELECT

Re: MySQL Data Vanishing with FireFox

2006-12-28 Thread Matt Neimeyer
I think it's your PHP application; how did you "debug" your application? All this is doing is letting our customer add their contacts to the database. This is on the "quick add" form and asks them to enter a first and last name and an email. I debugged by re-writing it temporarily to do this...

MySQL Data Vanishing with FireFox

2006-12-27 Thread Matt Neimeyer
We recently started getting reports that when users access our PHP based CRM system that it "didn't work". After much debugging and tracking down it looks like that ultimately what's happening is that SOMETIMES with a statement like... INSERT INTO Customers (A,B,C) VALUES ("One","Two","Three")

Re: Multiple MySQL Instances...

2002-11-01 Thread Matt Neimeyer
On Redhat Linux is there an easy way to have an ISP style setup where each "user" has their own database directory? Why not just create a database per user and run them all under the one MySQL instance? Then call the database the name of the user, or some unique name anyway. You can then limit

Multiple MySQL Instances...

2002-10-31 Thread Matt Neimeyer
Hey All, On Redhat Linux is there an easy way to have an ISP style setup where each "user" has their own database directory? Long story short, we have to implement a small in house server that will allow multiple departments to create their own little web pages. Perhaps I've missed something o

Query for Summary Report

2002-04-01 Thread Matt Neimeyer
Hello All, I've got an SQL question. I have a database that contains Reviews of some of a clients publications. The client is interested in generating some summary reports and I simply can't wrap my head around a single SQL query (if that's possible) that will generate the information I'm look