mysql

Mysql Count

I have the following query: select MIN(q.a), * FROM ( sub-query1 ) as q UNION sub-query2 How can I return the number of elements in query1 as a row of master-query? If i use count (*) i´ve only the count CountElementSub-Query1 i need some like that rowA, rowB, rowC, CountElementSub-Query1 rowA, rowB, rowC, Coun...

How do I make a row generator in mysql.

Is the a way to generate an arbitrary number of rows that can be used in a join similar to the oracle syntax: SELECT LEVEL FROM DUAL CONNECT BY LEVEL<=10 ...

How do I migrate easily from MySQL to PostgreSQL?

I'd like to migrate an existing MySQL database (around 40tables, 400mb data) to Postgres before it gets bigger. I searched the web and tried some migration-scripts (some of them can be found here). None of them works seamlessly - if it would be just a few glitches I had to fix manually, it wouldn't be a problem, but the resulting dumps d...

Automatically link keywords within page texts from word list

My site has a lot of dynamic stats with names of people, places and topics that all have their own associated pages. I want to automatically link each of these to their page based on data I've set up in a MySQL database of 'words' and 'links'. What would be an efficient way of automatically linking 20-50 occurrences of potentially 15-20...

Looking for a good list of MySQL storage engines.

I'm looking for something listing 3rd party engines but it doesn't have to be complete just reasonably so. I'm asking as a side effect of reading this. ...

comparing two fields in mysql -indexes?

I'm fairly certain I know the answer to this, but any ideas would be extremely helpful... First of all, this is MySQL 5.1.32-community. I have a large table (millions of rows, can't reduce the size - that is the reduced size) and the pertinent fields are two datetime fields. We'll call it date1 and date2. I need to run a select query...

Timezone Functions Help

Hi all, This might be a too bigger ask, but before I outsource it, I would like to try to understand it first, and do it for myself. I am working on a project that involves an existing database. I am building the site around the existing data, but have run into issues with timestamps. Basically, I am hoping someone can give me a snippe...

Large MySQL Update Query

Hi all, After getting an answer from this thread, it would save me alot of retyping if any readers could refer to it: link text I find that I need to update(within a mysql db) a timezone code, singularly (e.g 10+, 1-, etc) to olsen code (e.g "Europe/London", etc) according to what already exists within the user_timezone column. What wou...

MySQL: get maximum an minimum values in ONE query

hi folks, i'm searching for a way to get from two coloumns (lets say: posx and posy) the global (whole table) maximum and minimum with just one query. Database is MySQL thanks ...

What if 2^32 is just not enough?

Hi, what if you have so many entries in a table, that 2^32 is not enough for your auto_increment ID within a given period (day, week, month, ...)? What if the largest datatype MySQL provides is not enough? I'm wondering how should I solve a situation where I'm having so many entries added to my table which require unique ID, but I fill...

Sql Query not working!

INSERT INTO `test` (`x`, `y`) WHERE `id` = `$id` VALUES (`$x`, `$y`) Whats wrong with this query? I run this in a mysql_query() function in a php file. ...

How to implement check availability in hotel reservation system

I am developing website for my friend's very small resort, please see www.shivgangaresorts.com/dev This resort has 8 rooms in total and all rooms are of the same type, so every room is equally priced. I just need code or logic to check availability of given no. of rooms on given check-in and check-out dates. When somebody makes a rese...

How to hash passwords in MySQL?

How I will make every password in my user table encrypted(md5()) except one particular row using a single query? ...

null used with logical operator

I have a table with name,age and address.I have totally five rows of data in the table.For some rows the age is left null.I have to display all the data where age is not null. select * from sample_table where (age !=null); But no output is displayed and it doesn't give an error also.Please explain this.Thanks. ...

Inner Join

$query4 = mysql_query("SELECT * FROM comments WHERE content_id = '$id' AND content = 'thread' INNER JOIN users ON comments.poster = users.id ORDER BY comments.date ASC"); while ($comment = mysql_fetch_array($query4)) { } all the tables and columns exist and i am connected to the database but it stil...

How to use one query for two tables representing a poll with question and multiple answers?

Hi, I have two tables poll and poll_answers, which represent a poll and the options to choose from to answer a question from the poll. EX: DO I suck at SQL? yes yes, you do change craft and the co-responding tables: poll pollID pollQuestion 1 | DO I suck at Sql? poll_answers pollAnswerID pollAnswerText pollID 1 | yes | 1 2 ...

Hidden features of SQL Server 2009 AF edition and mySQL9.1.4 - fuzzy logic

It was reveled today that the new standard of SQL will include specification of some new database operations that will allow using databases for Fuzzy Logic operations. This new functionality is said to be implemented in SQL Server 2009 AF Edition and mySQL9.1.4 There were 2 new keywords introduced The new keyword is called JOINT which...

Serious MySQL Performance Issue (Joins, Temporary Table, Filesort....)

I've got a users table and a votes table. The votes table stores votes toward other users. And for better or worse, a single row in the votes table, stores the votes in both directions between the two users. Now, the problem is when I wanna list for example all people someone has voted on. I'm no MySQL expert, but from what I've figure...

FROM clause necessary in every SELECT statement

is the FROM clause necessary in every SELECT statement?Thanks.. ...

Can a set in MySQL be 0?

Can a set in MySQL be 0? ...