mysql

How to install MyODBC in Windows 7 ?

The downloaded installers from MySQL don't work - ie no mysql driver appears in the ODBC manager thing. I've downloaded the mysql-connector-odbc-noinstall-5.1.6-win32 version, copied myodbc5.dll and myodbcS.dll to c:\windows\system32 C:\dump\bin>myodbc-installer -d -a -n "MySQL ODBC 5.1 Driver" -t "DRIVER= c:\windows\system32\myodbc...

Grouping fields that partially match in MySQL

I'm trying to return duplicate records in a user table where the fields only partially match, and the matching field contents are arbitrary. I'm not sure if I'm explaining it well, so here is the query I might run to get the duplicate members by some unique field: SELECT MAX(id) FROM members WHERE 1 GROUP BY some_unique_field HAVING COU...

Updating an "order" column MySQL?

What's the best way to update an "order" column? Say I have an id column with 0 to 9, and order column from 0 to 9. Currently, it's in the database as: 0 0, 1 1, 2 2, etc My HTML page posts what it wants as the new order: 0 8, 1 3, 2 6, etc. (This is completely random, decided by the user). What's the best way to make the update? I...

Comparing Dates in yyyy-mm-dd format

There's a query I'm working on that has ... WHERE start_date >= DATE(NOW()) AND end_date >= DATE(NOW()) start_date/end_date are in the date format: yyyy-mm-dd What kinds of results should be expected from this kind of query? ...

Why are my processes in MySQL disappearing for some reason?

When I do: show processlist I see all my 20 servers connected to it. But, after a while, they drop off one by one. I know it's not the script problem. My script does Not terminate. Could it be that it time-out if it doesn't make a query within a certain time? How do I change that setting? Edit: The python script selects and inserts ...

What values are not stored on disk by InnoDB?

I have a pretty big table in InnoDB, and I want to minimize its size, within reason. For a few of the columns, the values are almost always the same in every row, so I want to try to take advantage of this. For example, if I have an int column (or datetime or varchar or whatever), would a null value in that column not actually be store...

Best Practices in Storing and Accessing WebApp User Privacy Settings?

If you allowed people to determine who could view their user information, what would be the best way in which to store and access that information? They would be setting their preferences in any of these ways: User Based (select specific users - ie. Block: "Munch", "Dummy") Checkbox Based (select one or many groups of users - ie. "My ...

How to make multiple submit buttons toggle with PHP

Hello all, My newbie question of the day is.... I have a comment function on my site that I have 3 versions of for the same page. I have one that has specific traits for A. signed in and looking at own profile B. signed in looking at someone elses profile C. Not signed in at all I have it working just great depending on what criteria t...

How to move local MYSQL DB up to remote DB server.

I have a local MYSQL DB running under WAMP that I need to move up to my production DB server. New to MySQL and need to know the best way to get this DB moved up. ...

Occasional MySQL query Error in PHP

I have a php file that has to be loaded as a web page. This page is 17Kb in size. It has a php mysql query script inside. the problem now, sometimes my mysql_query() lines gives an error. When being refreshed, it works again. It just have an error sometimes on that same line. I check the query string and it was okay, for if that was the...

MyISAM and InnoDB tables in one database

I have a database with about 30 tables and 5 tables of them is write-intensive. I'm considering Convert 5 write-intensive tables to use InnoDB engine and keep the rest on MyISAM engine Convert all tables to use InnoDB engine. I wonder which approach is better? To be more specific The reason I want to keep some table on MyISAM engi...

MySQL syntax for Join Update

I have two tables that look like this Train +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | TrainID | varchar(11) | NO | PRI | NULL | | | Capacity | int(11) | NO | | 50 | | +-...

inserting and updating constantly. is it better to have one huge table or 2 smaller tables

these tables will be constantly inserted new rows or updating. i have a big table containing, video url, title, description, tags, views, rating, comments should i divide this to 2 smaller tables id video url, title, description and link this to above. id video_id, tags, views, rating, comments ...

select items from mysql

making a simple movie review site to practice PHP. on one page ( a form) i write a title and review and submit, it then adds the info to mysql. i'm trying to create a page where i can delete reviews i've written. i'm going about this by returning all titles into a form tag, where i can select on and then submit that form to a process pa...

User/Subscriber sql query

I'm creating a table that shows all the registered users to which the current user has not yet subscribed to. But once he has subscribed someone, I need to filter that list to exclude those. Let's say the theres a table called subscribed which lists the User and to whom he is subscribed to. |UserId||SubscriberID| Its easy to make it...

moving wordpress mu to another domain - sql statements

I'm assuming these instructions are for "normal" wordpress... will this work with wpmu or do i need to modify this? Is there anything i should watch for? http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/ ...

Delete element from Mysql

hi, using a drop-down list that's populated from database fields, i need to select an option and then delete that from the database. i'm trying to do this by sending the form to a process php page where i pull in the select option from the post array and then delete it from the database and return to the index page. having issues with g...

calculate sum based on column name

Is there anyway to link one value to another based on it's column name? For e.g. in the following non-normalized table, I need to consider the value from the column state_amt_1 from another table if the state_cd_1 is 'TX' and add that value to the state_amt_2 if the state_cd_2 is 'TX' as well. create table states (state_id int not null ...

check constraint in mysql not working

First i create a table like CREATE TABLE Customer (SD integer CHECK (SD > 0), Last_Name varchar (30), First_Name varchar(30)); and then insert values in that table INSERT INTO Customer values ('-2','abc','zz'); Its doesn't shows the error.Accept the values in mysql ...

queries with hibernate

I have a database include eventType and event Tables eventType - id - name event - id - name - location - eventType_id - eventSubType_id where eventType_id and eventTypeSubtype_id reference to eventType Table. What i want to do with hibernate is select all events that have : eventType in (2,6) and eventSubType i...