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 `MaleNames` (
 `Name_ID` int(11) NOT NULL auto_increment,
 `Name` char(50) default NULL,
 `Frequency` decimal(5,3) default NULL,
 PRIMARY KEY  (`Name_ID`)
)

Some examples:

1, Aaron, 0.240
3, Abe, 0.006
13, Adrian, 0.069

What's the best way to select names at random from this but still take
into account frequency of use?

Thanks in advance!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 this returns

A A
B B
C C
D D

On 5.0.22 this returns

D D
D D
D D
D D

The odd thing is that if I remove the order by clause it works fine...
It also works fine if I remove the second copy of the column BUT this
is generic code so it might also be doing something like productid as
myvalue,productname as mydisp where the values are different.

Ultimately I can sort the array I end up with but it seems like this
should work. Especially since it did in 4.x.

Am I crazy? Doing something wrong?

Thanks!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 the select to see
if a contact has documents looks like this...

SELECT * FROM Contacts WHERE
   (id IN (SELECT contid1 FROM documents)
   OR id IN (SELECT contid2 FROM documents)
   OR id IN (SELECT contid3 FROM documents)
   OR id IN (SELECT contid4 FROM documents)
   OR id IN (SELECT contid5 FROM documents)
   OR id IN (SELECT contid6 FROM documents)
   OR orgid IN (SELECT orgid1 FROM documents)
   OR orgid IN (SELECT orgid2 FROM documents)
   OR orgid IN (SELECT orgid3 FROM documents)
   OR orgid IN (SELECT orgid4 FROM documents)
   OR orgid IN (SELECT orgid5 FROM documents)
   OR orgid IN (SELECT orgid6 FROM documents))

Which is UGLY... and I feel like there should be a better way (I know
I could break that out into a many-many relationship via a third
linking table but I'm not 'able' to do that now.)

The only change I can think of is to union the two halves of the
select but I'm not sure if that would be better... (IE id in (select
contid1 from documents union select contid2 from documents) etc)

Any advice or is this the best I'm going to get until I can reorganize
the underlying structure?

Thanks!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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) FIRST,
  ADD COLUMN b_col char(4) FIRST,
  ADD COLUMN a_col char(4) FIRST;

...does end up with a_col then b_col then c_col then d_col... but does
it matter and I doing something wrong?

Question 2: Is that any more efficient than doing...

   ALTER TABLE testtab ADD COLUMN c_col char(4) FIRST;
   ALTER TABLE testtab ADD COLUMN b_col char(4) FIRST;
   ALTER TABLE testtab ADD COLUMN a_col char(4) FIRST;

If it's NOT more efficient then I won't bother rewriting this one app
which runs slowly to join them up because it certain is easier to read
and debug with each modification on its own line.

Thanks!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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' doesn't exist'
when trying to dump tablespaces

It looks like it creates the export fine but I've been ssh-ing into
the dev box and doing it locally there just in case

Should I be worried? Is there some option that would supress that
(that i didn't see in mysqldump --help)? Is it truely harmless?

Thanks

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 the new instance.

 If you have InnoDB tables, there will be a problem. InnoDB maintains the
 database name in the shared tablespace, and it will no longer be able to
 find those tables.

Nope. These are entirely MyISAM tables... So I will probably give this
a try then.

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: Renaming a Database

2009-08-19 Thread Matt Neimeyer
No... I've pretty much avoided those. This WAS a Visual FoxPro app so
we're still at the stage where we really aren't leveraging MySQL
specific features. We're still pretty much just eliminating VFP
specific things.

Hence the one time nature of this renaming. Now that we're 5-10
customers in to upgrading we decided to actually define a naming
convention for the databases themselves so I've got to fix the 5-10
that are already out there (I could not change it... but then we have
to remember that these are special cases)

On Wed, Aug 19, 2009 at 10:28 AM, Rolando
Edwardsredwa...@logicworks.net wrote:
 If you have stored procedures, don't forget to update the db column with the 
 new db in mysql.proc as that does not automatically change.

 Rolando A. Edwards
 MySQL DBA (CMDBA)

 155 Avenue of the Americas, Fifth Floor
 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 DuBois
 Cc: mysql@lists.mysql.com
 Subject: Re: Renaming a Database

 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 the new instance.

 If you have InnoDB tables, there will be a problem. InnoDB maintains the
 database name in the shared tablespace, and it will no longer be able to
 find those tables.

 Nope. These are entirely MyISAM tables... So I will probably give this
 a try then.

 Matt

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:    http://lists.mysql.com/mysql?unsub=redwa...@logicworks.net



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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)
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 the new instance.

I know in the past I've used a similar method with single tables (stop
service, create a folder, drop in backups of tables, start service
muck with them) and I've had no problems... but I'm hoping wiser minds
will confirm I'll be okay OR that I shouldn't even try.

All in all, I'm trying to find a way to minimize OUR development time
as well as minimizing down time for the client. This would be a one
time thing to bring the database name in line with the new product's
newly picked conventions. (After we deployed four customers)

If it matters two of the installations are on OSX running a stock
MySQL 4.x installation and two are on Windows and I'm not certain the
version without checking.

Thanks!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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.

To deploy our app we basically do the following...

1. create and test
2. (on test server) mysqldump  export.sql
3. (on deployment server) mysql  export.sql

Now I need to move a set of changes from the test server to the
deployment server and I'm using mysqldiff to find the differences.

I've noticed that 90% of the changes are simply to align the collation
of fields and default collations for tables. Usually it's bouncing
between utf8_general_ci and latin1_swedish_ci.

99.99% of the records in our various customers databases will be
normal U.S. names and addresses but I know of a few customers that
target their base fairly narrowly and might POTENTIALLY need to enter
foreign names with accents and the like.

Ultimately what it comes down to is... how worried should I be about
making collations universal across at least a given customers
instances of the application? (If not all copies of the application
for all customers)

I already have a routine that I call normalize database that makes
sure default indexes are applied, etc... so it would be easy to add
to that routine to check for and correct collations but then do I
need to worry about existing data?

Thanks for the advice!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 query X
IN (1,2,3). That's easy enough (relatively speaking) but VFP also has
stuff like EMPTY(X) where any of Null, the Empty String (for Char),
-00-00 (or the VFP equivalent anyways for dates), False (for
Boolean), 0 (for Numeric) are considered empty without needing to
know the data type. So that starts getting a lot more complex since I'd
need to check the data type of the field in the right table... to be
able to convert it to something like (X is null OR X=) or (X is null
OR x=0) etc...

These are for customer stored queries... I've already manually
converted system queries and I'm frustrated to the point of giving
up and adding a column untested and let the end user figure it out
but that seems bad from the standpoint of lazy and poor customer
experience.

Thanks!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 duplicate linkages, but it's FAR from
an everyday occurance.

I have three options for dealing with the resulting duplicates and I
would appreciate some advice on which option might be best.

1. Attack the horrific spaghetti code that determines the Org and
Contact ids and then does the manual add. Creating Orgs and Contacts
as needed.

Calling this code horrific is a kindness... we're talking evil...
We've pretty much ruled this out due to the horror... but I mention
that I considered it.

2. Do a create table and populate that new table with the results of a
select distinct from the old table then swap the tables.

3. Do... SELECT count(*) AS tCount,OrgID,ContID FROM OrgContLink
GROUP BY OrgID,ContID HAVING tCount  1. Then for every record in the
result DELETE FROM OrgContLink WHERE OrgID=X AND ContID=Y LIMIT 1.
Then repeat until no results are found.

I like option 2 in so far as it's more... Atomic? One create...select,
one swap and its done. But even though it feels more pure I worry
that the overhead of completely creating and destroying entire tables
seems like throwing the baby out with the bathwater. IOW: Is
rebuilding a whole table for a few (hundred at most) offending
duplicate records overkill.

I like option 3 in that it leaves everything as is but does require a
lot of looping and feels inefficient. However, since we'd be running
this only after we do our imports it's not like this looping
inefficient code would be running all the time.

I know I could probably also put a unique key on both orgid and contid
but unless I'm reading the docs wrong I can't add a key in such a way
that the duplicate key insertion would silently fail without requiring
the offending application to do INSERT ... ON DUPLICATE KEY... which
gets back to modifying the spaghetti code from option 1.

Thanks in advance for your advice.

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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, Nathan Sullivannsulli...@cappex.com wrote:
 If you went with option #3, you could avoid the looping by using (tCount - 1) 
 as the LIMIT in
 the delete statement instead of always using 1.

 3. Do... SELECT count(*) AS tCount,OrgID,ContID FROM OrgContLink
 GROUP BY OrgID,ContID HAVING tCount  1. Then for every record in the
 result DELETE FROM OrgContLink WHERE OrgID=X AND ContID=Y LIMIT 1.
 Then repeat until no results are found.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 from test;

+-+
|operation|
+-+
| 6.0=6.0
| 6.0=6.0
| 6.06.1
| 6.06.2
+-+

But when I do select if(concat(6.0,direction,version),Y,N) from
test I ALWAYS get Y... which means I wouldn't get any meaningful
results if I used it in a where clause...

Any ideas on ways I can do this?

Thanks!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 Baisleybrentt...@gmail.com 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 right thing (spatial calculations = spatial
indexes?) but I looked at the docs and my head exploded. Can anyone
recommend a good book that takes me through it gently?

That said I'm intreged by the MBRContains and the Polygon functions...
If I read those right I could create a simplified circle (probably
just an octogon) to help eliminate false positives in the corners
when using a plain square as the enclosure.

 You don't have to do any re-architecture to change you subquery to a join:
 SELECT custzip FROM customers
 JOIN
 (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) AS zips
 ON custzip=zip

Will that work after a where clause? Multiple Times? For example...
(pseudo-code...)

SELECT * FROM customers WHERE saleslastyear  10
   JOIN (SELECT zip FROM etc) AS zips ON custzip=zip
   JOIN (SELECT MAX(date) FROM phonecalls) AS LastCalledOn ON custid=custid

Just from thinking about that... I assume that the only limitation is
that in a subselect you can do something like WHERE NOT IN (select
etc) but with a JOIN you are assuming a positive relationship? For
example using the JOIN methods above there isn't a way to simply do
AND custid NOT IN (SELECT custid FROM ordersplacedthisyear) other
than doing exactly that and adding this clause to the saleslastyear
clause. (In this particular case a column lastorderdate in customer
that was programatically updated on ordering would also be useful but
I'm thinking examples here... ;) )

I've never seen JOIN used outside of a traditional SELECT t1.*,t2.*
FROM table1 AS t1 LEFT JOIN table2 AS t2 ON t1.id=t2.id type of
structure so I kinda feel like I have a new toy...

Thanks!

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 index on lat (and/or long), and add the rectangle check to
 your where clause: WHERE latitude BETWEEN lt1 AND lt2 AND longitude BETWEEN
 ln2 AND ln2.  That way mysql can use the index to pare down most of the rows
 without having to call all those trig functions for every zipcode.

I like this idea the best (it always bothered me running a query that
involved multiple mathmatical functions).

So... Here's the scratch php code I ended up with... Anyone see any
problems with it? The only problem I see is that I think the old code
was more circular this will be a square (within the limits of a
square on a non-spherical earth... etc.. etc..) ... so there will be
more zip codes included in the corners. If there are too many
complaints about that I might look at some sort of overlapping
rectangle scheme instead of a square.

function ChangeInLatitude($Miles) { return rad2deg($Miles/3960); }
function ChangeInLongitude($Lat, $Miles) { return
rad2deg($Miles/3960*cos(deg2rad($Lat))); }

$Miles = 5;

$OriginalLat = 39.0788994;
$OriginalLon = -77.1227036;

$ChangeInLat = ChangeInLatitude($Miles);
$ChangeInLon = ChangeInLongitude($OriginalLat, $Miles);

$MinLat = $OriginalLat-$ChangeInLat;
$MaxLat = $OriginalLat+$ChangeInLat;

$MinLon = $OriginalLon-$ChangeInLon;
$MaxLon = $OriginalLon+$ChangeInLon;

My only other question is... when I explained the new query... On the
dependent subquery it says possible keys are zip, longitude and
latitude but it used zip. It seems like a better index would be
longitude or latitude? On the primary query, even though there is an
index on custzip it doesn't say it's using ANY indexes. I should
probably leave well enough alone... but I'm curious.

Thanks again!

Matt

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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 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

This query returned 21442 records in 1.08 seconds.

   SELECT custzip FROM customers

This query is still running half an hour later, with a Time of 2167
and a State of Sending Data (according to the mysql process list)

   SELECT custzip FROM customers WHERE custzip IN (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)

When I try to EXPLAIN the query it gives me the following...

id,select_type,table,type,possible_keys,key,key_len,ref,rows,Extra
1,PRIMARY,customers,index,NULL,cw_custzip,30,NULL,21226,Using where; Using index
2,DEPENDENT SUBQUERY,zipcodes,ALL,NULL,NULL,NULL,NULL,42144,Using where

If it matters both tables are INNODB and both customers.custzip and
zipcodes.zip are indexed. We used a program called DBConvert from
DMSoft to convert the data so it's exactly the same on both the VFP
side and the MySQL side. With all that in mind... VFP returns the
exact same query in 5-10 seconds and that includes render time in the
web browser.

By comparison... the query WHERE id IN (SELECT id FROM phone WHERE
phonedate = '2001-01-01' AND phonedate = '2009-06-18') returns
almost instantly.

I'm at a complete loss... The suggestions I've seen online for
optimizing Dependent Subquery's basically revolve around changing it
from a sub-query to a join but that would require more
re-architecturing than I want to do... (Unless I'm forced) Especially
since more than a few of those solutions suggested precalculating the
distance between zipcodes which only works if the distances are known
(only allow 10, 50 and 100 mile radi for example)

Any ideas?

Thanks in advance!

Matt

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



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...

$SQL = 'INSERT INTO Contacts (ContFirst,ContLast,ContEmail,UserID) VALUES ('
  .$_POST[ContFirst].','.$_POST[ContLast]
  .','.$_POST[ContEmail].','.$MyID.')';
echo $SQL;
$result = mysql_query($SQL,$db);

On the theory that the echo shouldn't change the contents of the $SQL 
variable.

Then on the same client machine, I open both browsers and launch the page. In
both browsers I can see the exact same statement (including the value 
of $MyID)

on the screen but in IE it works and on FireFox it doesn't.

As soon as I see the SQL on the screen I query directly (not through PHP) to
pull out the records and see that UserID is missing.


What data type is column 'C'?  Is it ENUM?


Nope. Nothing compilicated... ContFirst,ContLast are Char(30), ContEmail is
Char(100), UserID (the one failing) is INT(4). The typical values of 
UserID (at

least when debugging, and still failing) were numbers from 1-20.

Again... since I'm seeing the exact same statement on the screen in the echo,
theory has it that the exact same statement is being passed into the
mysql_query in the next line.

This is why I'm so baffled. Normally I echo the actual statement and it's
obvious what my error is. (Oh... a comma...) OR I echo the statement and see
that FireFox handles cookies different, or passes form values different, or
truncates $_GET at a different length or some other equally obscure thing but
still that the STATEMENT differs and I have something to start tracing from.
Here the statement is identical on both browsers and one fails and the other
doesn't.

Any other ideas?

Matt



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



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)

...that Three just doesn't make it into the database. So If I...

   SELECT * FROM Customers WHERE A=One

... I would get One,Two,

It seems to happen more often (maybe only) with FireFox. Other tables have no
problems that we can see. C is indexed... but we have other indexed fields in
the table that don't seem to be affected. It's not our biggest table by far...

I'm baffled. Where do I look next?

This is on a hosted box so we have limited access to the command line. This is
using PHP 4.3.11 with MySQL 3.23.58 on Apache 2.0.51 on a Fedora system (of
unknown version)

Thanks in advance...

Matt


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



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 looking for.

The one they are most interested in is this... We have a table (built on 
user submissions) that has something like this...

DocName DocSubj Usefulness
Processors  Upgrading   1
Processors  Upgrading   2
Hard Drives Upgrading   1
PrintersReviews 3

They want to get something like this...

Subject # Reviews   Avg Rating
Upgrading   3   1.3
Reviews 1   1

And I'm just missing something... I'm sure it has to possible but I can't 
think of good way to do this. (The only way I can think of is to run one 
query to grab all the distinct subjects, loop over that resultset and then 
fetch the count and average for that particular subject on each iteration) 
Any advice is greatly appreciated.

Matt


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php