I'm trying to create what I think is a relatively basic report for an online store, using MySQL 5.1.45
The store can receive payment in multiple currencies.
I have created some sample tables with data and am trying to generate a straightforward tabular result set grouped by date and currency so that I can graph these figures.
I want to...
I can't do this in MySQL
UPDATE tableA, tableB
SET tableA.column1 = SUM(tableB.column2)
WHERE tableA.column3 = tableB.column4
GROUP BY tableB.column4
;
Neither can I
UPDATE tableA,
(
SELECT SUM(tableB.column2) sumB, tableB.column4
FROM tableB
GROUP BY tableB.column4
) t1
SET tableA.column1 = sumB
WHERE tableA.column3 = column4...
I have a rake file that does a series of calculations on a database. Basically it adds usage on equipment regularly. At the end of the day it needs to add that days total to a monthly total table and update that same table. i use the following simple concepts:
To get data from the database is pretty simple:
@usages = Usage.find(:all)...
I have two tables: Stores and Items. The relationship is: Stores 1---* Items
In PHP/MySQL what would be the best (fastest/simplest) way to check if a particular item belongs to a particular store.
In other words given for example:
$store_id = 1;
$item_id = 12;
I want to check if item 12 belongs to store 1 (and not some other store)...
Hi-- I have a simple mySQL problem--
I have two tables, one is a user's table, and one is a photos table (each user can upload multiple photos).
I'd like to write a query to join these tables, so I can pull all photos associated with a user (up to a certain limit).
However, when I do something obvious like this:
SELECT *.a, *.b FRO...
Hi!
Is it a common thing for bigger applications and databases to GZIP text data before inserting it to the database?
I'll guess that any full-text search on the actual text field will not be working before unzipping it again?
Thansks
...
Hi, I'm trying to work with decimal data in my PHP and MySql practice and I'm not sure about how can I do for an acceptable level af accuracy.
I've wrote a simple function which recives my input text value and converts it to a decimal number ready to be stored in the database.
<?php
function unit ($value, $decimal_point = 2) {
ret...
When I run the custom tool to create the cs files for SubSonic all the templates now inject a letter g to the top of the cs files. To get this to compile I need to remove the g from the ActiveRecord.cs, Struts.cs, Context.cs and StoredProcedures.cs. Anyone else run into this? I am using MySQL.
...
Hi Guys
I have a small grails application running on Tomcat in Ubuntu on a VPS. I use MySql as my datastore and everything works fine unless I leave the application for more than half a day (8 hours?). I did some searching and apparently this is the default wait_timeout in mysql.cnf so after 8 hours the connection will die but Tomcat wo...
Hello All,
I have been building index on a 200 million row table for almost 14 hours. Due to resource over-consumption on the machine (because of a separate incident), the machine cashed. Clearly, I want to avoid another 14 hours to re-construct the index. Is there a way that I can resume the construction of index from the point (or sli...
So this works...
ALTER TABLE variation AUTO_INCREMENT = 10;
But I want to do this;
ALTER TABLE variation AUTO_INCREMENT = (SELECT MAX(id)+1 FROM old_db.varaition);
but that doesnt work, and neither does;
SELECT MAX(id)+1 INTO @old_auto_inc FROM old_db.variation
ALTER TABLE variation AUTO_INCREMENT = @old_auto_inc;
So does anyon...
Yo.
I'm trying to find a way to insert a whole database structure into MySQL with PHP. Now, my main question is if there's any way to do this beyond just inserting the whole bloody thing line by line?
edit: By "insert structure", i mean add the database and the tables - no more.
Thanks.
...
I mean, using css sprites on non static content like: Inside while(mysql_fetch_array())...
...
I am trying to display a list of my vbulliten threads on a non-vbulliten portion of my site. However I can't select the vbulliten database:
<?php
$host = "localhost";
$user = "my username";
$pass = "my password";
$dbname = "tableprefix_forum";
mysql_connect($host, $user, $pass) or die ("Could not connect to database server.");
m...
I have two tables, both having more than 20 million records; table1 is a list of terms, and table2 is a list of keywords that may or may not appear in those terms. I need to identify the terms that contain a keyword.
The 'term' field is a VARCHAR(320) and the 'keyword' field is a VARCHAR(64).
My current strategy is:
SELECT table1.term...
I have a game on Facebook called Rails Across Europe. I have a Best Scores page where I show the players with the best 20 scores, which in game terms refers to the lowest winning turn. The problem is that there are a small number of players who play frequently, and their scores dominate the page. I'd like to make the scores page open to ...
I tried the below query but it didnt executed giving error as :
> #1064 - 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 ')' at line 1
.
INSERT INTO `jos_menu` SET params = 'orderby= show_noauth= show_title= link_titles= show_intro= show_...
What could be the Consequence of inserting "id" in any autoincrementing 'id' containing table?
If I have a Tabe in which I have configured the column "id" as the auto incrmented, But still I am using an INSERT query in which id is defined, like wise INSERT INTO XYZ (id) values ('26');
How does it going to effect the table and the proce...
I want to extract a word from a string column of a table.
description
===========================
abc order_id: 2 xxxx yyy aa
mmm order_id: 3 nn kk yw
Expected result set
order_id
===========================
2
3
Table will at most have 100 rows, text length is ~256 char and column always has one order_id present. So performance is ...
Can anyone help me on how this error arises?
My previous version of MySql.dll is 1.0.7.30072 then I have upgrade my MySql.dll version into 1.0.10.1 to prevent opening new MySql transaction when the previous transaction is not yet committed.. Is it the error arises because of the new dll?
...