How to optimize this?
SELECT e.attr_id, e.sku, a.value
FROM product_attr AS e, product_attr_text AS a
WHERE e.attr_id = a.attr_id
AND value
IN (
SELECT value
FROM product_attr_text
WHERE attribute_id = (
SELECT attribute_id
FROM eav_attr
WHERE attribute_code = 'similar_prod_id'
)
AND val...
This is the code i have:
The 'media_work' table has an 'order' field that indicate the order of the files.
I want to sort the result of the 'media_work' table to get the first item (image)
This code works but doesn't order the 'media_work'
SELECT work.id, work.title, media.file_name_thumb,media_work.order,
COUNT(media.file_name_thumb)...
hi i run python program where im inserting many many new entries to database,
this new entries are spread accross multiple tables.
what is the quickest way to load them into database?
at now im using something like this
LOAD DATA LOCAL INFILE file
INTO TABLE table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(col1, col2, c...
Hello,
I have spent sometime researching the forum and other places to resolve this but yielded nothing and I have decided to ask.
I have log files containing NMEA sentences. I have stored this sentences which are in hundreds of thousands in mysql database. I have stored the longitudes and latitudes as double datatype. I want to conver...
Hello,
I am trying to connect to mysql using c# in vs2010. I installed the 6.3.5 version of the .net connector from the mysql site. I try using the following connection string -
<add name="mySql" connectionString="Server=localhost;Database=mydb;Uid=User;Pwd=mypass;" providerName="System.Data.OleDb.OleDbConnection, System.Data, Versio...
Hi Friends,
My need is to move the MYSQL 5.0 database from my development m/c to actual production m/c,
How I can do this ???
On production m/c MYSQL is not installed, MY SQL 3.5 drivers are present.
but on my m/c MYSQL 5.0 and MYSQLDrivers 5.0 are resent so will on production server 3.5 driver will support 5.0 vertion...If I created DS...
I have this query:
SELECT * FROM article
WHERE (state = 2 OR state = 3) AND category_id = 100
ORDER BY mod_date DESC
And I have defined this index:
category_id_idx:
state
category_id
mod_date
When I run the query with an EXPLAIN, it returns this:
id: 1
select_type: SIMPLE
table: article
type: range
possible_keys: category_id...
I have entires, equipments, brands, times and seasons.
entries:
id
time
equipment_1
equipment_2
equipments:
id
id_brand
brands:
id
name
times:
id
id_season
seasons:
id
name
My actual SQL query is:
SELECT entries.*, times.id_season AS id_season
FROM entries, seasons
WHERE entries.time = times.id
But in the final qu...
I have a subquery problem that is causing poor performance... I was thinking that the subquery could be re-written using a join, but I'm having a hard time wrapping my head around it.
The gist of the query is this:
For a given combination of EmailAddress and Product, I need to get a list of the IDs that are NOT the latest.... these or...
I have some entries in a field that look like this: NEvada city or nevada City... Is there a way to update the database so that entries have initial caps: Nevada City?
...
I have around 30 columns in a MySQL table. I want to calculate how many column fields for a particular row are empty. This table is for storing user information. I want to find out how many profile fields (such as 'Name', 'Age', 'Location' - all of which are stored in a separate column) are empty/haven't been filled in by the user.
Th...
I dont want to rely on all those ORM/Querybuilder etc. tools in Kohana 3.x. I just want do use plain old SQL to Insert a new row in my table of my MySQL Database.
How can I do that?
...
Hello,
I've been trying to save PHP session data in a MySQL database, but can't get it to work.
For a simple example, here's code that should increment a counter with each visit. I've seen other examples, etc. but can someone please tell me why this code isn't working? (Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5....
I'm working on a web application that's using CakePHP and MySQL. Depending on the circumstances, I may be using one of two computers and I may be behind a proxy server that won't allow me to directly modify any code on my web server. Because of this, I've installed XAMPP on my machines to act as a local web server, and I keep my code i...
I have a large SQL script that creates my database (multiple tables, triggers, and such. Using MySQL), and I need to execute that script from within a python program. My old code did this:
sql_file = open(os.path.join(self.path_to_sql, filename), 'r')
sql_text = sql_file.read()
sql_stmts = sql_text.split(';')
for s in sql_stmts:
c...
Hey, I have an issue with an SQL Query. Lets take this example data
itemID catID attrib1 attrib2
1 1 10 5
2 1 10 7
3 1 5 10
4 2 18 15
I want to return the best item for each category (with attrib1 having priority over attrib2)
Obviously, "SELECT catI...
Hi all!
I have class-configurer fluent nhibernate for MySQL:
class MySqlInitializer : INHibernateInitializer
{
public Configuration GetConfiguration()
{
var dbServer = "localhost";
var dbUsername = "root";
var dbName = "nhibernate";
var dbPassword = "";
var ormAssembly = "NHibernate_MySQL....
My app. is in C# 3.5 and MySQL 5.1. It is a Windows based standalone application. It is running successfully since last two years except few issues and that too were later found out to be MySQL bugs. The bug disturbed the real-time reports as it store the same timestamp in two rows.
I don't know whether MySQL fixed it or not so I want t...
Is there any way to select a record and update it in a single query? I tried this:
UPDATE arrc_Voucher
SET ActivatedDT = now()
WHERE (SELECT VoucherNbr, VoucherID
FROM arrc_Voucher
WHERE ActivatedDT IS NULL
AND BalanceInit IS NULL
AND TypeFlag = 'V'
LIMIT 1 )
which I hoped would run the...
SELECT DISTINCT sectionID FROM (
(SELECT sectionID,MATCH (content) AGAINST ('blah') AS relevance FROM sectioncontent WHERE MATCH (content) AGAINST ('blah')) AS alias
UNION DISTINCT
(SELECT sectionID,MATCH (name, description) AGAINST ('blah') AS relevance FROM sections WHERE MATCH (name, description) AGAINST ('blah'))
)
I would even...