mysql

MYSQL - multiple count statments

I'm trying to do a lookup on our demographioc table to display some stats. However, since out demographic table is quit big I want to do it in one query. There are 2 fields that are important: sex, last_login I want to be able to get the total number of logins for various date ranges (<1day ago, 1-7 days ago, 7-30 days ago, etc) GROUPE...

mysqldump problem with case sensitivity? Win->linux

When i dump a table with uppercase letters using mysqldump it comes out as lower case in my > dump.sql file. I found a report here in 2006, almost 4 years old http://bugs.mysql.com/bug.php?id=19967 A solution here suggest making linux insensitive. I rather not if possible. Whats the easiest way to copy a win32 db into linux? ...

Problems with large MySQL tables

Hello guys, I'm having some problems with large MySQL tables. The tables are in MyIsam type and some queries can take up to 15 seconds. These tables are mostly read, so this is becoming a problem. My guess is that the software is issuing slow/poorly written queries to the database. Example: implicit joins x explicit joins. If i rewrite...

Average of a Sum in Mysql query

I am having some problems creating a query that gives me the average of a sum. I read a few examples here in stackoverflow and couldn't do it. Can anyone help me to understand how to do this please? This is the data I have: Transaction_x0020_Number Product_x0020_Code Sales_x0020_Value Date Cashier 000356 350...

jQuery + ajax livesearch

I am doing a mysql database search and retrieving some results via ajax livesearch using the example on w3schools and i want to manipulate those results (drag and drop them) but im having a problem because the script loads before you enter the search and get the results so it does absolutely nothing no the search results. Any thoughts on...

Help creating a SQL Query

Somewhat new to SQL queries and I need a little help with my join. I am supplied with gid For each of these I need to grab name from table wp_ngg_gallery then join in table wp_ngg_pictures and grab field filename limit 1 order DESC by field imagedate Anyone able to help? ...

MySQL - How do I insert an additional where clause into this full-text search (updated)

I want to add a WHERE clause to a full text search query (to limit to past 24 hours), but wherever I insert it I get Low Level Error. Is it possible to add the clause and if so, how? Here is the code WITHOUT the where clause: $query = "SELECT *, MATCH (story_title) AGAINST ('$query' IN BOOLEAN MODE) AS Relevance FROM stories WH...

jQuery: Sorting hierarchical data?

Hi everybody, I have tried for some time to work out a way of sorting nested categories with jQuery. I failed to build my own plugin to do this, so I tried to find something that were available already. Tried a few hours now with this one, http://www.jordivila.net/code/js/jquery/ui-widgetTreeList_inheritance/widgetTreeListSample.aspx an...

Data store appropriate for sensor data

Hi, What do you think is a data store appropriate for sensor data, such as temperature, humidity, velocity, etc. Users will have different sets of fields and they need to be able to run basic queries against data. Relational databases like MySQL is not flexible in terms of schema, so I was looking into NoSql approaches, but not sure ...

MYSQL UPDATE with IN and Subquery

Hi i have tables like this : table entry : id | total_comments ___________ 1 | 0 2 | 0 3 | 0 4 | 0 table comments : id | eid | comment ___________ 1 | 1 | comment sdfd 2 | 1 | testing testing 3 | 1 | comment text 4 | 2 | dummy comment 5 | 2 | sample comment 6 | 1 ...

JDBC batch insert performance

I need to insert a couple hundreds of millions of records into the mysql db. I'm batch inserting it 1 million at a time. Please see my code below. It seems to be slow. Is there any way to optimize it? try { // Disable auto-commit connection.setAutoCommit(false); // Create a prepared statement String ...

Mysql: Perform of NOT EXISTS. Is it possible to improve permofance?

I have two tables posts and comments. Table comments have post_id attribute. I need to get all posts with type "open", for which there are no comments with type "good" and created date MAY 1. Is it optimal to use such SQL-query: SELECT posts.* FROM posts WHERE NOT EXISTS ( SELECT comments.id FROM comments WHERE comments.post_id =...

Storing HTML in MySQL using Java

Hello there again, So, I'm working on a project now where I should store webpages inside a database, I'm using crawler4j to crawl and Proxool along with MySQL Java Connector to connect to my database. When I tested the application I got: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'HTMLData'. The HTML...

MySQL Returns wrong values on SELECT statement

All, I'm wondering if this is a MySQL bug, but since I've seen others playing with larger numbers than this, I'm thinking I'm doing something wrong here. Here is my table structure for the table I'm querying: mysql> describe ipspace6\G ************* 1. row ************* Field: id Type: decimal(39,0) unsigned Null: NO Key: ...

Locking DB w/ Large Reads (Ruby-on-Rails/Heroku)

Currently I have a Web API running on Heroku that is constantly writing information we're collecting from other data sources (currently theres about half a GB of data and it's growing very quickly). We're looking to add a reporting system on top of the current database that we can use to extract useful information out of the DB. The pr...

MySQL create stored procedure fails but all internal queries succeed alone?

Hi all, I just created a simple database in MySQL, and I am learning how to write stored proc's. I'm familiar with M$SQL and as far as I can see the following should work: use mydb; -- -------------------------------------------------------------------------------- -- Routine DDL -- ------------------------------------------------------...

Need a SQL statement focus on combination of tables but entries always with unique ID

Hi All, I need SQL code to solve the tables combination problem, described on below: Table old data: table old name version status lastupdate ID A 0.1 on 6/8/2010 1 B 0.1 on 6/8/2010 2 C 0.1 on 6/8/2010 3 D 0.1...

Having a Link Only Appear If a Logged-In User Appears on a Dynamic List

Hello, For the function below, I would like the link <div class="footervote"><a href="http://www...com/.../footervote.php"&gt;Vote&lt;/a&gt;&lt;/div&gt; to only appear if the logged in user currently appears on editorlist.php. (I. e. if the loginid in the function corresponds to any of the usernames that currently appear in editorlist....

Problem connecting to remote mysql database

I am trying to connect to a mysql db on a shared server. I am using a java application to make the connection. Problem doesn't happen when I connect to localhost db. URL = "jdbc:mysql://SHARED HOST IP:3306/DBNAME"; USER = "dbUSER"; PASS = "dbPASS"; Connection conn = DriverManager.getConnection(URL, USER, PASS); java.sql.SQLExcep...

Access denied for user 'root@localhost' (using password:NO)

I'm new to mysql, I'm trying to run Wordpress inmy windows desktop and it need Mysql. I install everything with Web Platform Installer which provided by microsoft. I never seta root password for mysql and in final step of installing wordpressit askfor root password of mysql. What is the default password for root (if there is one) and h...