mysql

setting up replication in mysql pros and cons

Basically I want to setup a replication server for mysql datbase. I am completely new to this concept and appreciate any help pointing me in the right direction. If at all the slave goes down, will it effect the master in anyway? Thanks. ...

Aggregating MySQL rows by day

Hi, I have a MySQL table like this: Payments +----+---------------------+---------+ | id | date (sorted DESC) | payment | +----+---------------------+---------+ | 5 | 2010-03-26 00:00:01 | 100.00 | | 4 | 2010-03-19 00:00:02 | 55.12 | | 3 | 2010-03-19 00:00:01 | 20.00 | | 2 | 2010-03-12 00:00:02 | 320.00 | | 1 | 2010-03-12 0...

Activestate python and MySQLdb

Hi, I have installed activestatepython and am trying to import MySQLdb import mySQLdb gives me an error stating "No module called MySQLdb" I have tried searching but all the resources out there explain how to set up the mySQLdb for unix, not for windows, can you please tell me how I can do that with Activestate python?...

HTML Purifier Coding Help?

I read the http://htmlpurifier.org/docs/enduser-youtube.html doc, but I still can't figure out where to put the code to allow object, param and embed tags and Use experimental features with my htmlpurifier. Can someone please show me how to do this? ...

Having a problem displaying data from last inserted data

I'm designing a staff rota planner....have three tables Staff (Staff details), Event (Event details), and Job (JobId, JobDate, EventId (fk), StaffId (fk)). I need to display the last inserted job detail with the staff name. I've been at it for couple of hours and getting nowhere. Thanks for the help in advance. My code is the following: ...

How can I store an object which contains a Queue in MySQL?

My object, contains a queue which stores DateTime objects. Storing objects with just the usual single dimensional properties is not a problem. What if, I want to store a queue in MySQL using C#. I am using MySQLite and ADO.NET wrapper of System.Data.Sqlite; ...

Does COUNT(*) always return a result?

If I run a query such as: SELECT COUNT(*) as num FROM table WHERE x = 'y' Will it always return a result, even when the query doesn't match any record? Or do I need to validate and make sure a row is returned as the result? ...

Diffence between "select count(null)" and "select count(1)"

In MySQL Select 1 from mytable and select null from mytable both return the same number of rows. While select count(1) from mytable returns the rowcount and select count(null) from mytable always returns 0. Why? ...

Java Audit table logging, MySQL equivalent of CONTEXT_INFO.

Hi, I am looking for the MySQL equivalent of CONTEXT_INFO that is present in SQL Server. Or any other session variable like thing using which I can pass the username to the trigger. I am currently working on logging table data for audit. I need to pass the username of the logged in user to the delete trigger. Any ideas? We are deletin...

create a mysql stored procedure in squirrel sql

Hi, I'm using squirrel sql 3.1 to create a store procedure on a mysql db. The sp works fine when I create it with other clients, but when i try with squirrel sql it gives me a bunch of errors. I tried to change the statement separator on the session properties but it says that property are not editable. You guys have any idea? Let me kn...

MySQLi prepared statements error reporting

I'm trying to get my head around MySQli and I'm confused by the error reporting. I am using the return value of the MySQLi 'prepare' statement to detect errors when executing SQL, like this: $stmt_test = $mysqliDatabaseConnection->stmt_init(); if($stmt_test->prepare("INSERT INTO testtable VALUES (23,44,56)")) { $stmt_test->execute(); ...

mysql query help in selecting top votes

i have table posts and posts_votes in posts_votes i have id and post_id and vote now i want select from posts where have top votes count in last 1 day using this to set the time from_unixtime(post_date) >= SUBDATE(NOW(),1) thanks in advance ...

How do I retrieve 10 days data up to date 'XYZ' from mysql with Perl when some days data are missing, i.e. public holidays.

Data is put into a MYSQL DB in the following format: | 2010-03-18 | 1.580 | 1.590 | 1.560 | 1.580 | 164500 | 1.580 | | 2010-03-19 | 1.570 | 1.570 | 1.560 | 1.570 | 178300 | 1.570 | | 2010-03-22 | 1.550 | 1.560 | 1.540 | 1.560 | 309000 | 1.560 | | 2010-03-23 | 1.560 | 1.560 | 1.550 | 1.550 | 284900 | 1.550 | I need to se...

Mysql Query problem ?

ID NAME AMT 1 Name1 1000 2 Name2 500 3 Name3 3000 4 Name1 5000 5 Name2 2000 6 Name1 3000 consider above table as sample. am having a problem in my sql query, Am using like this. Select name,amt from sample where amt between 1000 and 5000 it returns all the values in the table between 1000 and 5000, instead I want to get maximum a...

I need to create Trigger for delete action which backsup all fields old value in audit table

I need to create Trigger for delete action which backsup all fields old value in audit table. I have a table structure for audit table as id, menuid, field, oldvalue, changedone now whenever any of the row is deleted from its mother table(menu) having 21 fields in count, every fields old value should get insert in the audit tab...

Datamining on a mysql database

Hello, I Begin with textmining. I have two database tables with thousands of data.. a table for "skills" and a table for "skills categories" every "skill" belongs to a skills categorie. a "skill" is , physicaly, a varchar(200) field in the database, where there is some text describing the skill. Here are some skills extracted from ...

mysql min ignores null - need workaround/tweak

For this query SELECT min(date) min_date FROM order_products group by order_id min_date ignores the NULL values in a group of order id. In my case I want min_date = NULL if the group has a order_products tuple with null value in date. Any idea how can I achieve this ? ...

Mysql JOIN problem

I have 2 mysql tables : Question with the following columns : id, question, nranswers Nranswers must be a number from 1 to 5 And the other table is Answers with the following columns: questionid, userid, answer . Now the problem is that I want to get the replies for each answer for one question(id 22 let's say) . P.S. If the n...

Ways to Actively Update Java from MySQL

What is the best way to update a Java or GWT program from MySQL. For example, a MySQL database which holds Weather information... updating whenever the weather changes a degree. How would I update a Java / GWT field with each update. Would I use a thread to query every few seconds?? ...

Ordering by number of relationships in Hibernate

Hi, I've got two models which have a one-to-many relationship. Lets say its an auction for a product and the product can have many bids. Basically what I'd like to do is pull out all the products but order them by the number of bids they've received. What I've got so far is: "select p from Product as p join p.bids b where b.product=p...