I have a batch job that I run on a table which I'm sure I could write as a prepared statement. Currently it's all in Java and no doubt less efficient than it could be. For a table like so:
CREATE TABLE thing (
`tag` varchar,
`document` varchar,
`weight` float,
)
I want to create a new table that contains the top N entries for ev...
I have the following MYSQL query which when executed shows me all the invalid Comment_IDs in the table Order_Info that don't exist in the Order_Comments table. How would I modify this query to set the Comment_ID value to NULL for each record found?
SELECT Order_Info.*
FROM Order_Info
LEFT JOIN Order_Comments ON Order_Info.COM...
Stupid easy problem, but I haven't been able to find an elegant solution. I want to store time intervals in a MySQL columns, for instance:
1:40 (for one hour, 40 minutes)
0:30 (30 minutes).
Then be able to run queries, summing them. Right now I store them as INT values (1.40), but I have to manually do the addition (unless I'm missing ...
I have a big troubles with display of UTF-8 data retrieved from the MySQL to the Linux-based C++ application. UTF text is shown as question marks.
The application uses the MySQL C API. So I passed the UTF-8 option after mysql_init() and before mysql_real_connect():
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, 'utf8');
and
mysql_op...
I have a table like this (MySQL 5.0.x, MyISAM):
response{id, title, status, ...} (status: 1 new, 3 multi)
I would like to update the status from new (status=1) to multi (status=3) of all the responses if at least 20 have the same title.
I have this one, but it does not work :
UPDATE response SET status = 3 WHERE status = 1 AND title...
My aim is to have a simple, form based CMS so the client can log in and edit the MySQL table data via an html form. The login is working, but the edit page isn't returning the values from the MySQL table, nor am I getting any errors.
I'm still amateur, and I first started the following code for a class project, but now plan to implement...
I want to add an amount to the rows returned from a select. I've been trying things along the lines of:
select *,
3 as amount
from products
where etc....
...and it works. However, I want to do the same thing for lots of rows in one go along the lines of:
select *,
3 as amount,
2 as amount,
4 as amount...
Hello. I have 3 mysql tables: events, artists and (artist) descriptions. All of them are in many-to-many relations.
Table 'events':
ID | eventTitle | etc.
-----------------------
1 | event 1 |
2 | event 2 |
etc.
Table 'artists':
ID | artistName | etc.
-----------------------
1 | artist 1 |
2 | artist 2 |
etc.
T...
I'm using the mysql CLI, however the result displays always wraps around on my terminal screen. is there any way to specify to mysql the size of my terminal screen?
...
I'm parsing a feed that contains a "created at" entry, formatted like this:
Thu, 08 Oct 2009 23:01:33 +0000
I need to be able to store this in a MySQL table, in a DateTime datatype. Then, I want to select rows WHERE datetime clause equals or in range between dates and/or times.
I have two questions:
Will this string be acceptable ...
I'm having a problem with Python's subprocess.Popen method.
Here's a test script which demonstrates the problem. It's being run on a Linux box.
#!/usr/bin/env python
import subprocess
import time
def run(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
return p
### START MAIN
# copy some rows from a source tab...
I know I can bind params in Kohana like this
$this->db->query('SELECT * FROM products WHERE id = ?', array(14));
But is there a way to do it with identifiers (or whatever they are called?)
As in
$this->db->query('SELECT * FROM products WHERE id = :id', array(':id' => 14));
Thanks
...
Hi, i have a problem that i can't solve ! (sqlite3, but i think it would be the same than MySql)
I have those tables (image) :
And i would like to find all the bus lines (with type and number) that go to two different streets from which i have the street_id (12 and 14 for exemple).
The result shall give to the customer all of the bus...
I'm considering my options to implement pretty links for a new website.
I understand how to make the basics work, for example doing:
/view/postTitle/7895
I can just pick up the id 7895 and just ignore the title.
However, I see that some websites manage to get rid of ids altogether:
/view/postTitle
How does this work?
The only way ...
Say I have two MyISAM tables:
tab_big: id1, id2, id_a, ord (5 billion records)
tab_small: id1, id2, id_b (1 billion records)
CREATE TABLE IF NOT EXISTS `tab_big` (
`id_a` int(10) unsigned NOT NULL,
`id1` int(10) unsigned NOT NULL,
`id2` int(10) unsigned NOT NULL,
`ord` int(10) unsigned NOT NULL DEFAULT '...
All,
I need to retrieve the date in some specific format in MYSQL.
For eg,
it should return month/year(10/2009).
My MYSQL version is 5.1.
Thanks,
Srinivasan.
...
I am creating a website...and i want to give a liberty to users, to upload the data of excel file and then i want to save that excel data inside mysql database on runtime...
kindly help me in performing this task...
you can mail me at...."[email protected]"
thank you
Amitesh
...
I need a search with a relevance algorithm and the database is mysql. I have to sort the results by date, if keyword is in title or not, number of apparitions of the keyword in the text and so on.
Match against doesn't give me that much control.
...
I read from mysql website, I execute this:
SELECT CURTIME()
But then how to get the value? Using mysql_fetch_assoc()??
...
Hi
I have been asked a question but I cannot even start to answer is so could some one give me an idea of were to start on how to possibly answer it ,
I am not looking for the answer just some teaching on how to answer it
here goes:
Assuming "regsister_globals" and "magic_quotes_gpc" are turned on, Whats wrong with this piece of c...