mysql

dotConnect for MySQL license cannot be used with TOAD

Hello. I am trying to connect to MySQL with TOAD. I have dotConnect for MySQL (trial) installed on my PC. The very first time TOAD's connection with MySQL worked fine and I worked with that connection across 2 days. However, now after my system re-start, when I am trying to make the same connection, I get following error message: Assemb...

MySql - autocomplete

Hi Everyone, I am creating an Ajax autocomplete application and would like know if there is an SQL query I can use for this purpose - e.g if someone types "p" I would like to retrieve all words beginning with "p", if they add "e" retrieve all words starting with "pe" - and continue like that. Someone suggested the query below but I don...

Character Encoding Problem

I know this sounds really silly but what character encoding should I use for something that looks like this in UTF-8 â��â�¥ �¼���½�±�¼� The website is in English. This is something user generated content which is stored in the database that is utf_general_ci and displayed on the screen . I just want to display it ...

mysql random rows

how to form a query to select 'm' rows randomly from a query result which has 'n' rows. for ex; 5 rows from a query result which has 50 rows i try like as follows but it errors select * from (select * from emp where alphabet='A' order by sal desc) order by rand() limit 5; u can wonder that why he needs sub query, i need 5 differen...

Row versioning for MySql

Hi, Is there a built-in row-versioning mechanism for MySQL? Something similar to the 'timestamp' column in MS SqlServer. ...

MySQL query to search for people with specific skills

Hi, I'm inexperienced with SQL... i'm trying to figure out how to search my database for personnel with specific skills. I want to generate a table which contains two columns, Name and Skill(s) The initial search is currently performing this query: SELECT * FROM User_Skills LEFT JOIN skills ON User_Skills.Skill_id = Skills...

How to round a DateTime in MySQL?

I want to discretize the DateTime with the resolution of 5 minutes. I did it in C#, but how to convert the following code to MySQL? DateTime Floor(DateTime dateTime, TimeSpan resolution) { return new DateTime ( timeSpan.Ticks * (long) Math.Floor ( ((double)dateTime.Ti...

MySQL - JOIN 2 tables with 2 ID's in common

Hi, I have 2 tables that I need to get information from, and would like to get the information in one single query. The situation is this : table "matches" : id team_A_id team_B_id table "teams" : id name The objective is to retrieve information from table "matches" (football matches) and join the information with the table "team...

Is it legal to using MySQL in commercial environment?

I won't release my software source code, and it will be a commercial application. Can I use the MySQL within paying any fee to MySQL? if it is illegal, any alternative database suggest? ...

How to convert DateTime to a number in MySQL?

How can I get the total number of seconds since '1970-01-01 00:00:01' from a DateTime instance in MySQL? ...

Multiple insert/update statements inside trigger?

Hi all, Just a quick question that no doubt someone out there will know the answer to. I need to be able to do multiple insert/updates within a trigger. Every attempt ends with failure :( DROP TRIGGER IF EXISTS `Insert_Article`// CREATE TRIGGER `Insert_Article` AFTER INSERT ON `Article` FOR EACH ROW insert into FullTextStore (`Table...

How to update and select a row within one query in SqLite?

I want to update and select one row within one query in SqLite. In MySql my wanted query would look like this: SET @update_id := -1; UPDATE data SET `Status` = 'running', Id = (SELECT @update_id := Id) WHERE `Status` = 'scheduled' LIMIT 1; SELECT * FROM data WHERE id=@update_id;" The above query will set the Status to 'running' and...

PHP: MySQL error hook?

I've been developing a web application with PHP and MySQL. The other day, I made some changes to the database and adapted one page to the new table layout but not another page. I didn't test well enough, so the site went online with the error still in the other page. It was a simple MySQL error, and once one of my co-workers spotted it, ...

Can I do it with only session or do I need ACL?

I am planning to create a simple project management system with PHP/MySQL/Codeigniter. There will be a super-admin, an admin and around 20 users. User A, B, C... And there will be around 50 projects. Project 1, 2, 3 ... User A and B will be able to access project 1 pages, User C, D and F will be able to access project 2 pages etc. Ca...

MYSQLDB python module

Team, I am using MySQLdb module of python on FC11 machine. Here, i have an issue. I have the following implementation for one of our requirement: connect to mysqldb and get DB handle,open a cursor, execute a delete statement,commit and then close the cursor. Again using the DB handle above, iam performing a "select" statement one some...

database design question

Hello, I am trying to design a database but I need some help with the relationships. Am i getting the table design right? Here is the database idea.. User will submit a howto, each howto will have one or more steps associated with(a one to many). each step can have random pictures associated with(another one to many). so I am thinking ...

Installing MySQL and mysql gem on Snow Leopard

It´s really a hard job figuring out how to get MySQL and mysql gem up and running on Snow Leopard 10.6.2. I followed the instructions of various posts but was not successful yet: I build MySQL Version 5.1.39 from source and it installed successfully. When trying to login using (mysql -u root -p) mysql returned the following error: ERR...

mysql query, better way to write this?

EDIT I'm understand the table is a mess. I took over this project and am rewriting the PHP and making serious changes to the database. I am not asking how I should layout the database. I need to make a quick, temporary fix and am looking for a better way to write the query below. END EDIT Hi there! So I have this query(below) this is ...

SQL Query to select bottom 2 from each category

In Mysql, I want to select the bottom 2 items from each category Category Value 1 1.3 1 4.8 1 3.7 1 1.6 2 9.5 2 9.9 2 9.2 2 10.3 3 4 3 8 3 16 Giving me: Category Value 1 1.3 1 1.6 2 9.5 2 9.2 3 4 3 8 Before I migra...

Create table and fill with test data provided as text

What is your way of creating and populating test tables in MySQL when looking into SO questions where tables (but not CREATEs) and test data (but not INSERTs) are provided? And what client do you use? EDIT: Here's a simply example of what I mean on SO. ...