Hi,
I have a sql script file that upon import creates a table in a MySQL database and fills it with 2800 record. These are all the postal codes for the country Belgium.
Now I would like to make a Ruby on Rails database migration file from this. Any idea how I can do this?
Maybe there is a way around? Telling in a database migration fi...
Hi-- I've written a PHP script that runs via SSH and nohup, meant to process records from a database and do stuff with them (eg. process some images, update some rows).
It works fine with small loads, up to maybe 10k records. I have some larger datasets that process around 40k records (not a lot, I realize, but it adds up to a lot of wo...
I have this piece of SQL that is being fed to Mysql.
CREATE TABLE pn_history(
member INT,
action INT,
with INT,
timestamp DATETIME,
details VARCHAR(256)
)
But is comes back as an error about the syntax.
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syn...
So client gives me a string like "1,23,23,abc,ggg,544,tf4," from user 12 . There can be infinit number of elements with no spaces just value,value,... structure. I have users table (with users uId(key), names etc). I have streams table with ( sId(key), externalID, etc values). User sends me externalId's. And I need to hawe externalId's ...
Hi.In my WinApp I am using DataGridView in tab control.When I am adding to table in another tab ,it does not update datagridview. After closing and re-opening app it shows new value.I connected my table with wizard to datagridview. And in my Button action after adding new value to data base I used
this.BindingContext[this.dataGridView...
I've worked on a project using a proprietary non-SQL DB where queries could be interrupted and in the codebase there were quite some spots where that functionnality was used and made perfect sense (for example to stop a long running query that gets cancelled by the user, or when a more recent query takes place and renders the previous qu...
Using the answer from this question: http://stackoverflow.com/questions/662877/need-mysql-insert-select-query-for-tables-with-millions-of-records
new_table
* date
* record_id (pk)
* data_field
INSERT INTO new_table (date,record_id,data_field)
SELECT date, record_id, data_field FROM old_table
ON DUPLICATE KEY UP...
Hey there,
I have an sql database. In this database is 3 tables I need to query. The first table has all the item info called item and the other two tables has data for votes and comments called userComment and the third for votes called userItem
I currently have a function which uses this sql query to get the latest more popular (in te...
Following on from a question earlier today this answer was given to read the data into an array and separate it to print vehicle type and then some data for each vehicle.
<?php
$sql = "SELECT * FROM apparatus ORDER BY vehicleType";
$getSQL = mysql_query($sql);
// transform the result set:
$data = array();
while ($row = mysql_fetch_assoc...
Usually I would have a table field called ID on auto increment. That way I could order using this field etc.
However I have no control over the structure of a table, and wondered how to get the results in reverse order to default.
I'm currently using
$q = mysql_query("SELECT * FROM ServerChat LIMIT 15");
However like I said there i...
Hello,
This should be fairly simple, but I can't get my head around it.
I have an event in my database with a startDate and an endDate.
I need to display this event (based on the current date) on every day the event occurs.
So if the event starts on the 3rd of May and finishes on the 7th of May, the SQL query must find it on every si...
I need a SQL query that returns results matched by EITHER of the following SQL queries:
Query 1:
SELECT "annotations".* FROM "annotations" INNER JOIN "votes" ON "votes".voteable_id = "annotations".id AND "votes".voteable_type = 'Annotation'
WHERE (votes.vote = 't' AND votes.voter_id = 78)
Query 2:
SELECT "annotations".* FROM "annota...
I have tried to follow the steps outlined in
http://www.howtoforge.com/mysql_database_replication
for Database Replication.
I have created the database exampledb, and create some tables and load them with values.
But when I execute
USE exampledb;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
I do not get any output, it says 0 rows ...
I have a REPLACE query running for a few days now on a few MyISAM tables, the largest having 20+million records. I need it to stop.
It is, basically:
REPLACE INTO really_large_table (a,b,c,d)
SELECT e,f,g,h FROM
big_table INNER JOIN huge_table ON
big_table.x LIKE CONCAT('%', huge_table.y, '%');
I need to KILL it, and I am worried ...
I'm creating query to retrieve the latest posts in a forum using a SQL DB.
I've got a table called "Post". Each post has a foreign key relation to a "Thread" and a "User" as well as a creation date.
The trick is I don't want to show two posts by the same user or two posts in the same thread. Is it possible to create a query that contai...
I am trying to setup a script that would test performance of queries on a development mysql server. Here are more details:
I have root access
I am the only user accessing the server
Mostly interested in InnoDB performance
The queries I am optimizing are mostly search queries (SELECT ... LIKE '%xy%')
What I want to do is to create rel...
On insert I am catching the unique constraint mysql_errno() 1062.
This works fine but I want to find the existing row to re-instate or modify it.
Is there are method to obtain the row id on insert fail? I tried mysql_insert_id() but realised that would only return the row I'm inserting (or failed to insert) therefore, I get 0.
Is the...
I have a Table structure as
id, trackid, table_name, operation, oldvalue, newvalue, field, changedonetime
Now if I have 3 rows for the same "trackid" same "field", then how can i select the latest out of the three?
i.e. for e.g.:
id = 100 trackid = 152 table_name
= jos_menu operation= UPDATE oldvalue = IPL newvalue = IPL...
I have a Table structure as
id, trackid, table_name, operation,
oldvalue, newvalue, field,
changedonetime
Now if I have 3 rows for the same "trackid" same "field", then how can i select the latest out of the three?
i.e. for e.g.:
id = 100 trackid = 152 table_name
= jos_menu operation= UPDATE oldvalue = IPL newvalu...
is this right?
mysql -uroot -ppassword mydb < myfile.sql.gz
...