mysql

Efficient way to implement this ActiveRecord Query

Hi I am using MySQL database and I have a datetime field inside it. In my rails application I have to fire a Query similar to the following, MyTable.all(:conditions=>{my_date.to_date=>"2010-07-14"}) The my_date field is of datatype datetime. I should omit the time and should directly compare it with a date (but I am encountering an e...

Filtering data in Mysql

I know WHERE, LIKE, IN filters in database. But how can I filter with "except" ? I want to select all data except a specificdata. Thanks in advance ...

Is there any way to turn off the 50% gotcha on fulltext search?

I am trying to build a product search for a jewelry store. I know that if a term is in over 50% of the entries then it has a weight of zero. So right now if I do a search for "diamond" I get no results because over 50% contain diamond. Is there a way to change that? ...

MySQL command line client for Windows

Is there any nice command line MySQL client for windows? I mean a single exe that allows connecting and running a sample query. I've googled and only could find big graphical environments like toad or mysql workbench. I need only a simple command line tool, where can I download sth like this? EDIT: I don't want to install the whole MyS...

How to the data available in a 4th column in cakephp?

Hi there, Currently i'm having a problem. I want to access the data available in the 4th table of my DB. Click here to see the db image I have the tables in this way: Categories --> Categories_Companies --> Companies --> Affiliates Like it shows in the image i'm on the categories and in the Categories view (views/categories/view.ctp)...

getdate() in mysql

I am creating a system which updates the user activity when something is done. I have a variable $userhistory= 'User edited '.$info.' on July 14 2010 or (07-14-2010); I want to know how can i get the date automatically. for sql query i am using NOW(), but in a variable like $userhistory how do i get the date and it want it only in eithe...

MySQL server has gone away: Rails on Passenger (Redmine)

Hello all, I am making use of Redmine a web based software tracking tool, its perfect for my needs. However, I keep coming across this error in my production.log. ActiveRecord::StatementInvalid (Mysql::Error: MySQL server has gone away: SELECT * FROM issue_relations WHERE (issue_relations.issue_from_id = 6) ): app/models/i...

is there a way to view past mysql queries with phpmyadmin?

i'm trying to track down a bug that's deleting rows in a mysql table. for the life of me i can't track it down in my php code, so i'd like to work backwards by finding the actual mysql query that's removing the rows. i logged in to phpmyadmin, but can't find a way to view the history of past sql operations. is there a way to view t...

What is required in order to implement a geo-spatial/proximity search?

I want to better understand what is required in order to implement a geo-spatial (aka proximity) search. I'd appreciate clarification on the following: Beyond the latitude & longitude for corresponding zip codes, what if anything, is required? Can anyone recommend any resources (books, websites, etc.) for understanding the formulas ...

write php code to mysql?

Is there any possibility to write php code to mysql and then use it in php, in order to process the output, not just write it? I would like to use mysql, instead of included file...if it is possible. ...

Quick and dirty way to make forms for editing fields in MySQL databases

Hi, I have a seriously ridiculous deadline to meet because I'm picking up from a disgruntled developer. I have a database with a few tables and some one-to-one mappings, nothing too complicated. I need to create a backend for searching and editing these tables in some kind of HTML form style (not necessarily web-based if there is a bet...

MySQL GROUP BY age range including null ranges

I'm trying to count the number of people by age ranges, and I can almost do it with 2 problems: If there are no people in a given age range (NULL), then that age range does not appear in the results. For example, in my data there's no entries for "Over 80" so that date range does not appear. Basically, it looks like a mistake in the pr...

MySQL: Problem with max() and group by - wrong values

Hello to all! I have a problem with a SQL statement: Using this select a.id as ID, a.dur as DUR, DATE(FROM_UNIXTIME(timestampCol)) as date, a_au.re as RE, a_au.stat as STAT from b_c inner join c on b_c.c_id = c.id inner join a on c.id = a.c_id inner join a_au on a.id = a_au.id inner join revi on a_au.rev = revi.rev where b_...

mysql store procedure recusion not passing variable.

Hi I'm having problems getting this to work in mysql. DELIMITER $$ DROP PROCEDURE IF EXISTS `insert_v5tag_count` $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `insert_v5tag_count`(IN call_tag_id INT,IN rel_tag_id VARCHAR(100),IN inp_object_id VARCHAR(100),IN level_num VARCHAR(100)) BEGIN DECLARE done2 INT; DECLARE i_tag_id2 INT; DECLA...

Constraints to follow for Indexing in MySQL

Hello I would be indexing my database tables. Present constraints I am following is indexing the columns which would be most used in "where" clauses in my queries. Would that be the right constraint or are there any other constraints or checks to be followed?? And how would indexing affect the database on the whole? ...

Export mysql database to Microsoft Access (.mdb)

I'm looking for some tips on how to export a mysql database into a .mdb file that is readable by Microsoft Access 2007+ (and editable too!). It needs to be a script that can run on a Linux server (maybe using PHP?). I can't seem to find out anything anywhere. Any ideas? Cheers! ...

Rails and mysql Cluster disk data

I would like to know whether anybody has deployed a Rails APP + Mysql cluster, saving the data on disk space. I saw a provider as brightbox, doing the same. There is no much info, as well as gems/plugins to work with. ...

mySQL Update Query. Left JOIN.

Hello, I have wasted my whole afternoon on this so any help is greatly appreciated. Table Schema Table Name: file_manager_folder Rows: id , parentId, name My query simulates moving a folder into another folder and accepts an array using IN(?). I want my update to only 'move' a folder if there is not already a folder with the same...

Create table if not exist - unexpected T_STRING

Hi, I am having an issue trying to create a table for a website I am working on, here is the database code I am using but I get an error at line 2. <?php CREATE TABLE IF NOT EXISTS 'speakers' ( `id` int(11) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `image` varchar(255) NOT NULL default '', ...

Legal question about the GPL license + .NET dlls

Hey all, We're considering using MySQL in a .NET project. We're aware that there's a connector available on mysql.com that's dedicated to .NET, and that it's under a GPL license. We're having trouble interpreting the GPL license so we've thought we'd ask around : If we were to use that connector, are we obliged to make the project's so...