mysql

Error from mysql query, trying to join tables

Can anyone see why this code is returning an error? "SELECT a.widget_id, c.additional_widget_id FROM exp_widgets AS a, INNER JOIN exp_widget_additional AS c ON a.entry_id = c.additional_entry_id WHERE a.template = 3 AND c.additional_template_id = 3 AND (a.entry_id = 6 OR c.additional_entry_id = 6) "; Any help appreciated. Thanks. ...

shopping cart software mysql ajax

Hi, I am working on a shopping cart(open cart) software and have this question. I am not familiar with mvc framework. What i want to know how to show content(mysql) inside a div when you click on a link. There will be 8-10 links and clicking on each should fetch its corresponding products. So for example category 1 | category 2 | categ...

Variables in a mysql View

I am building a view and I am having a bit of an issue with in this view. In the view I need to query 1 database and table to pull the datasource for another database and set the result as a variable. Then I need to use that variable to query a separate database. Here is my current code: set @remoteDatasource = ( SELECT n...

How to select all parents of a node in a hierarchical mysql table?

I have a MySQL table that represents data for a tree GUI component, here's the structure of my table: treeTable ( id INT NOT NULL PRIMARY KEY, parentId INT, name VARCHAR(255) ); parentId is a self-referencing foreign key. Now I want to write a stored procedure which gets a node id and returns a result set that contains tha...

database transaction

If I'm using a mysql client(eg. squirrel) to execute an update query, after 10 seconds, I cancelled the query, would there be partial update or would everything that's done be rolled back? ...

mysql on xp performance issues

Please could you let me know if there are any performance issues with using mysql on windows xp. The mysql serves over 10 client server apps, which query the database simultaneously ...

Delphi and mysql - Unable to connent to server..maybe custom connection reqd

I am coding an application for my company wherein i want to parse the results of a mysql query and display them in my application but i am facing a problem conecting to the database. the ip address of the server is : 172.30.192.20 and before i can ping it i have to add route on my pc something like this route add 172.30.192.0 mask 2...

MySql SELECT AS - Append all field names

I'd like to do something like this: SELECT table.id AS prefix_id, table.name AS prefix_name ... and have the prefix added dynamically to all field names rather than selecting them all manually (ie SELECT table.* AS prefix_* or something) Hopefully I've described that accurately. Any thoughts? Edit To be clear, the reason I'm askin...

How do I write this SQL statement to get the ad and posting? (PHP/MySQL)

I am a little confused on the logic of how to write this SQL statement. When a user clicks on a tag, say HTML, it would display all the posts with HTML as its tag. (a post can have multiple tags) I have three tables: Posting-->posting_id, title, detail, etc tags-->tagID, tagname postingtag-->posting_id, tagID I want to display all t...

mysql update too slow when joining multiple tables

Hi, I have two tables. they looks like as follows: Id (int) Tags char(128). the column Tags in table A does not have value. It is empty. The column Tags in table B has value. What I want to copy the Tags in table B to corresponding place of table A. the mapping is based on Id. My sql query is: update A INNER JOIN B set A.Tags = B...

Sample/Example needed for a table/field setup

Can someone explain the statement below to me with a working sample/example. thanks in advance. You can not create duplicate fields, but simply add a single extra field, "coupleId", which would have a unique id for each couple; and two rows (one for each person) per couple; then JOIN the table against itself with a constraint like a.cou...

What is the right way to do flexible columns in database?

Im storing columns in database with users able to add and remove columns, with fake columns. How do I implement this efficiently? ...

Iterating over a database column in Django

I would like to iterate a calculation over a column of values in a MySQL database. I wondered if Django had any built-in functionality for doing this. Previously, I have just used the following to store each column as a list of tuples with the name table_column: import MySQLdb import sys try: conn = MySQLdb.connect (host = "localho...

comparing rows on a mysql table

Ok here's the deal I got one table with a bunch of client information. Each client makes up to one purchase a year which is represented by an individual row. there's a column for the year and there's a column the contains a unique identifier for each client. What I need to do is to construct a query that takes last year and this year and...

Why do I have to run migration twice for values to appear in DB?

Inexplicably, when I run the following migration code using rake, the column, but not the values, appear in the MySQL DB table: class AddTypeToItems < ActiveRecord::Migration def self.up add_column :items, 'type', :string, :limit => 100, :null => false Item.find_by_name('YUMMY_JUICE').update_attribute(:type, 'Juice') Item...

Count enumerated values?

If my table looks like this: daily_individual_tracking', 'CREATE TABLE `daily_individual_tracking` ( `daily_individual_tracking_id` int(10) unsigned NOT NULL auto_increment, `daily_individual_tracking_date` date NOT NULL default ''0000-00-00'', `sales` enum(''no'',''yes'') NOT NULL COMMENT ''no'', `repairs` enum(''no'',''yes'') ...

Rails: using set_table_name to join across different databases on the same mysql server

For legacy reasons, my model's tables are stored in two different databases on the same MySQL server. At first I just used establish_connection to specify the second database on the models that used it. However, when I established a has_many :through connection between two models in different databases, it blew up because MySQL cannot ...

Reading data from a MySQL database into a HTML Table?

So i am working on a project and need some advice. I have a MySQL database that stores events, i know how to code this functionality in PHP but im just stuck of a few specifics. As the project that I am creating is a timetable, the most important attributes are the day of the event, starting time and finishing time. Once i have read t...

error in arabic script in mysql

i inserted data in mysql database which includes arabic script. while the output displays arabic correctly, the data in mysql looks like garbage. something like this: '&#1589;&#1614;&#1608;&#1605;&#1615; &#1579;&#1614;&#1604;&#1575;&#1579;&#1614;&#1577;&#1616; &#1571;&#1610;&#1617;&#1575;&#1605;&#1613; &#1605;&#1616;&#1606; &#1603;&#16...

Working around MySQL error "Deadlock found when trying to get lock; try restarting transaction"

Hi all: I have a MySQL table with about 5,000,000 rows that are being constantly updated in small ways by parallel Perl processes connecting via DBI. The table has about 10 columns and several indexes. One fairly common operation gives rise to the following error sometimes: DBD::mysql::st execute failed: Deadlock found when trying to...