mysql

insert a value calculated from another table

Hi All I would like to do a query for inserting a value calculated starting upon another table. I don't want to use Temporary tables and I would like to do everything in one singel query. It is possible? I tried this one below but it doesn't work. Thanks AFeG INSERT INTO MyTable( `DATE`, `Name`, `Total` ) VALUES ( '2010/01/01', ...

MySQL GROUP BY performance issue

This is the query I'm performing (without some Joins that are not relevant): SELECT a.*, c.id FROM a LEFT OUTER JOIN b ON a.id = b.id_anunciante LEFT OUTER JOIN c ON c.id = b.id_rubro GROUP BY a.id Each row of "a" is linked with 1 to 5 rows in "b". The problem is that GROUP BY has performance issues (it takes 10x or more using GROUP ...

How to order, group, order with mySQL

Here is a simplified version of my table tbl_records -title -created -views I am wondering how I can make a query where they are grouped by title, but the record that is returned for each group is the most recently created. I then will order it by views. One way I guess is to do a sub query and order it by created and then group it b...

Select over multiple databases

In a project at work i have to improve performance. The data of the app is spread over many databases. I was told that is better for organizing the data. Whatever. Is there a performance penalty when i do a select over some tables spread on several databases instead of a select on those tables in one database? ...

PHP + MySQL + Ajax Search or Data Framework

i tried several ajax/js "frameworks" and "data grids" to show some mysql data, but the problem is that i have to many columns (like 50) and some of then need to be links, images and also get the ID from the same query to create those links the main features that im looking is good search, sort and filter i dont have the time to make al...

How to get number of rows without SELECTING all rows?

How can i get the number of rows like mysql_num_rows but without having a mysql resource to work from, because i don't know the future scale of my webapp and it could take an hour just to get the number of rows ;) thanks! ...

Send Facebook Message from Personal website - possible?

I have been comissioned to make a website complete with a user login system with multiple user groups. The users of this site will most likely also be administrators of facebook groups as well. Does anyone know if it is possible to associate facebook credentials with the login, and be able to send out group wide messages from this sepa...

Why do I have to use the keyword [open] in order launch mysql

I have mysql installed on my mac (running OSX Snow Leopard). According to everything I have seen, all I should have to do is type mysql at the command line to bring up the monitor. I do have /usr/local/mysql in my path. Instead, I have to type open mysql. That opens the monitor. However, I cannot login as root. I tried sudo open mysql...

How to select multiple fields in the same row? (MySQL)

I asked a question yesterday about using MySQL to tally results to a survey. Now my question is, if I had a table of survey questions, a table of survey choices, and a table of users answers to those survey questions, how would I select the survey question along with all the choices for that survey within the same query? Questions Tabl...

Query to Delete Posts Older than X Days in WordPress

I run a blog where the community can post time-sensitive community links (sports scores and such). After a certain time, those posts are no longer useful, so I want to delete them in batch via a MySQL query, but I don't know how. I imagine that getting rid of those posts entirely is more than just deleting from the wp_posts table, right?...

mysql numeric database limitation

is there a limitation of database name can't be created as numeric? mysql> CREATE DATABASE 1; ...results in: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 ....or am I doing something wrong? ...

MySQL: Duplicate Entry for Key 2

I'm not sure what I'm doing to cause this error. The query: INSERT INTO node (type, language, title) VALUES ('bout', 'en', 'the title 3') The error: #1062 - Duplicate entry '0' for key 2 The table: CREATE TABLE `node` ( `nid` int(10) unsigned NOT NULL auto_increment, `vid` int(10) unsigned NOT NULL default '0', `type` varch...

Java: DB Communications Link Failure

My program that connects to a MySQL database was working fine. Then, without changing any code used to set up the connection, I get this exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any ...

mysql wildcard (ignore one/two characters in search)

I'm trying to update tables in my wordpress mu database. I want to update all wp_options tables. These tables are named like this: wp_1_options wp_2_options ...and so on. How do i affect all tables with wp_any-character-here_options? I tried to query for: UPDATE wp_%_options SET option_value = replace(option_value, 'http://www.o...

Checkbox in first cell of each row in an html table displaying mysql query results

I have a simple HTML table display of data that results from an MySQL query. I would like to have a checkbox in the first cell of each row. I am asking for some suggestions as to where I might go looking for information on how to make this interactivity possible, as I'm sure this is not a "quick-answer" type of question. Example: http...

Can MYSQL support databases with sizes around 4 GB? Will I have any performance issues?

I am planning to have a database of size more than 12 million records all of them in a single table and no other joins etc, used for search, filtered based on field names of the table, approximately 4 GB size in MYSQL backend and php frontend. Question is can MYSQL support databases with sizes around 4 GB, Will I have any performance is...

mysql: change http://old-domain.com to http://new-domain.com in all tables

I'm using statements from here: http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/ but i had to modify them because i'm using multi-user and it has different table structure (weird numbered tables). As you can see in my previous question it's all REALLY problematic... So my question is: Can ...

How to filter posts with multiple category names in WordPress?

I am trying to work around a plugin for Word Press called "Event Calendar 3". This plugin lets you create events and then feeds them into a SQL table in the Wordpress database. However, this plugin does not discriminate between different types of events, eg repeating events, one-off events. The beginning of my solution was to create a c...

mystery mysql error

Hello all. I'm by no means experienced in mysql and keep getting an error in this lines of code: $sql= "INSERT INTO songs (unique_show_id, artist, date, year, city, state, venue, taper, transfered_by, source, mic_loc, lineage, uploaded_by, uploaded_on, show_notes, show_xml) VALUES('$showId', '$artist', '$showDate', '$year,...

How to make a onmouseover work in mysql catalog

Hi everyone! I'm having difficulty creating a button on my catalog page, the catalog page returns either 8 15 or 20 products from a mysql database so i use a loop to pull each product out of the database, and i need a addtocart button which uses javascript to create an onmouseover effect the code is as follows echo "<a href=\"catalog...