mysql

Duplicate entries on mysql on insert using doctrine

Hi all! I am facing a very weird problem with mysql and doctrine [with help of codeIgniter]. I am trying to make a simple migration script taking all records from one table and after a little process, saving them to another. However, on my laptop [running windows and wamp] I get double numbers of the original table records to have bee...

How can I check if I made optimal mysql database?

Are there any ways to check whether my Mysql database and PHP script are optimal? I want to figure it out and fix if it's possible till I publish it on internet for many users. Thanks. ...

displaying multiple values with .FIELDS adodb

i am getting some data: rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "' and batchstate='" + bstate + "'" If Not rs.EOF Then MsgBox rs.Fields("rowid") End If if the rs.filter returns multiple records, how do i get rs.fields("rowid") to give me multiple rowid values? ...

SQL query , whats this?

I never seen SQL like that before: SELECT * FROM !.tables WHERE id = ! What's it doing? ...

Best way to store weekly event in MySQL?

I have a table of weekly events that run on certain days of the week (e.g. MTWTh, MWF, etc.) and run on a certain time (e.g. 8am-5pm). What's the best way to store day of week information in MySQL to make retrieving and working with the data easiest? My CakePHP app is going to need to retrieve all events happening NOW(). For time of d...

What is wrong with my SQL syntax here?

New to SQL. I'm looking to create a IT asset database. Here is one of the tables created with php: mysql_query("CREATE TABLE software( id VARCHAR(30), PRIMARY KEY(id), software VARCHAR(30), key VARCHAR(30))") or die(mysql_error()); echo "Software Table Created.</br />"; This is the output from the browser when I run the script: ...

Native language problem in mysql with tinyMCE

I have turkish character problem in mysql database when adding content with tinymce from admin panel. Charset is: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9"" /> How can I solve this? Thanks in advance ...

MySQL Cursor Issue

I've got the following code - this is the first time I've really attempted using cursors. DELIMITER $$ DROP PROCEDURE IF EXISTS demo$$ DROP TABLE IF EXISTS temp$$ CREATE TEMPORARY TABLE temp( id INTEGER NOT NULL AUTO_INCREMENT, start DATETIME NOT NULL, end DATETIME NOT NULL, PRIMARY KEY(id) ) $$ CREATE PROCEDURE demo()...

Shell script that iterates through a sql "delete" statement

I need a shell script that deletes 1000 rows from a massive database until there is no more rows left It is very simple, but i am very weak in shell scripting, and the many tutorials online offer extremely similar, but different nuances in syntax UPDATE: Would it be possible to get some sample code? I need to delete 1000 rows at a t...

Tool for convert SQL code to diagram

can any one say some way to convert SQL code to data diagram like ERD ? for som DBMS like MySQL or general SQL ...

How do I Correct for False Positive using MBRContains in a mySQL db?

I've got a mySQL database. I'm testing points to see whether they are in particular polygons. Unfortunately, I'm getting false positives. So, for example, if I test to see if different points are in polygon ABCD, the MBRContains query returns 6 points, when I know for a fact that only 5 of the points are in that polygon. I know that MB...

Regex to match anything (including the empty string) except a specific given string.

I'd like to test whether a string contains "Kansas" followed by anything other than " State". Examples: "I am from Kansas" true "Kansas State is great" false "Kansas is a state" true "Kansas Kansas State" true "Kansas State vs Kansas" true "I'm from Kansas State" false "KansasState" true ...

MySQL query puzzle - finding what WOULD have been the most recent date

I've looked all over and haven't yet found an intelligent way to handle this, though I feel sure one is possible: One table of historical data has quarterly information: CREATE TABLE Quarterly ( unique_ID INT UNSIGNED NOT NULL, date_posted DATE NOT NULL, datasource TINYINT UNSIGNED NOT NULL, data FLOAT NOT NULL, PRIMARY KEY (unique_ID)...

Query only specified number of items from parent/child categories

I'm having trouble figuring out how to query every item in a certain category and only list the newest 10 items by date. Here is my table layout: download_categories category_id (int) primary key title (var_char) parent_id (int)</pre></code> downloads id (int) primary key title (var_char) category_id (int) date (date)</pre></code> ...

Normalize database or not? Read only MyISAM table, performance is the main priority (MySQL)

I'm importing data to a future database that will have one, static MyISAM table (will only be read from). I chose MyISAM because as far as I understand it's faster for my requirements (I'm not very experienced with MySQL / SQL at all). That table will have various columns such as ID, Name, Gender, Phone, Status... and Country, City, Str...

How to remove htmlentities() values from the database?

Long before I knew anything - not that I know much even now - I desgined a web app in php which inserted data in my mysql database after running the values through htmlentities(). I eventually came to my senses and removed this step and stuck it in the output rather than input and went on my merry way. However I've since had to revisit...

How can I get This SQL query to search without MATCH. It returns everything too broad.

$sql = mysql_query("SELECT id, email, url, section, date_modified FROM emails WHERE MATCH(id, email, url, section, date_modified ) AGAINST('$query' IN BOOLEAN MODE) ORDER BY date_modified DESC"); ...

Aggregate Functions on subsets of data based on current row values with SQL

Hopefully that title makes sense... Let's say I have an employee table: ID | Name | Title | Salary ---------------------------- 1 | Bob | Manager | 15285 2 | Joe | Worker | 10250 3 | Al | Worker | 11050 4 | Paul | Manager | 16025 5 | John | Worker | 10450 What I'd like to do is write a query that will give me the above ...

MYSQL: how to search for fields that hold values sep. by commas?

hi. i have 2 tables: tags (id_tag,name) news (id,title,data,tags) The field news>tags is a varchar(255). Im planning to put data like this in that field: "1,7,34" That means that a particular row in news is linked to tags 1, 7 and 34 from the tags table. Then, how can i search for ALL news records that have the 34 value (among othe...

BULK INSERT problem in MySQL

I get an error with the following SQL command for bulk insert. BULK INSERT libra.faculty FROM 'd\:faculty.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ); Here's the error message: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your ...