Foreign Key Error

2011-02-14 Thread Victor Subervi
Hi; I have this command: create table if not exists categoriesRelationships (ID integer auto_increment primary key, Store varchar(60), Parent integer not null, foreign key (Parent) references categories (ID), Child integer not null, foreign key (Child) references categories (ID)) engine=innodb;

Re: Foreign Key Error

2011-02-14 Thread Victor Subervi
: Victor Subervi [mailto:victorsube...@gmail.com] Sent: Monday, February 14, 2011 3:09 PM To: mysql@lists.mysql.com Subject: Foreign Key Error Hi; I have this command: create table if not exists categoriesRelationships (ID integer auto_increment primary key, Store varchar(60), Parent integer

Too Strange for Words

2010-09-18 Thread Victor Subervi
Hi; Can someone please explain to me why Passengers.weight comes up null for the last value sometimes, and other times it comes up with the value 155?? mysql select p.id, c.id, p.name, p.weight, m.amount, p.round_trip, c.first_name, c.middle_name, c.last_name, c.suffix, c.sex, p.confirmation,

Complex Select Query

2010-08-24 Thread Victor Subervi
Hi; I have the following query: select * from spreadsheets s join products p on p.Item=s.Item join categories c on p.Category=c.ID where s.Client=%s order by p.category, c.parent; mysql describe products; +-+--+--+-+-++ | Field | Type

Re: Complex Select Query

2010-08-24 Thread Victor Subervi
: Victor Subervi victorsube...@gmail.com Sent: Aug 24, 2010 1:14 PM To: mysql@lists.mysql.com Subject: Complex Select Query Hi; I have the following query: select * from spreadsheets s join products p on p.Item=s.Item join categories c on p.Category=c.ID where s.Client=%s order by p.category

Join Problem

2010-08-16 Thread Victor Subervi
Hi; I have this code: select f.id from Flights f join Planes p where f.plane_id=p.id and p.in_service=1 mysql describe Flights; +-+---+--+-+-++ | Field | Type | Null | Key | Default | Extra |

Why Does This Drop Fail?

2010-07-22 Thread Victor Subervi
Hi; mysql alter table personalData drop foreign key Store; ERROR 1025 (HY000): Error on rename of './test/personalData' to './test/#sql2-14ce-a61' (errno: 152) mysql describe personalData; +---+--+--+-+++ | Field |

Re: Why Does This Drop Fail?

2010-07-22 Thread Victor Subervi
on Store. How? TIA, V Regards John Daisley Microsoft SQL Server 2005/2008 Database Administrator Certified MySQL 5 Database Administrator Certified MySQL 5 Developer Cognos BI Developer Telephone: +44 (0)7918 621621 Email: john.dais...@butterflysystems.co.uk On 22 July 2010 14:02, Victor

Re: Why Does This Drop Fail?

2010-07-22 Thread Victor Subervi
On Thu, Jul 22, 2010 at 9:09 AM, John Daisley daisleyj...@googlemail.comwrote: Sorry, my bad! Must learn to read the whole message!! This can be caused because when a foreign key is created mysql adds an index key to the column in addition to the foreign key. Why I'm not sure, but I'm

Creating a Data Dictionary

2010-07-12 Thread Victor Subervi
Hi; Perhaps I have a conflict of terms here, but my googling mysql data dictionary turned up material that didn't seem to correspond with my problem. In python I can create dictionaries: my_dict = {'1': 'one', '2': 'two'} Now, I would like to create the equivalent of an enum in which I could

Two Primary Keys

2010-06-29 Thread Victor Subervi
Hi; I have the following: create table pics ( picture_id int auto_increment primary key, product_sku int not null primary key, picture_num int not null, picture_desc varchar(100), picture_data longblob ); which doesn't work I need to auto_increment and declare primary key on two

Re: Two Primary Keys

2010-06-29 Thread Victor Subervi
2010/6/29 João Cândido de Souza Neto j...@consultorweb.cnt.br As far as I know, if you have an auto_increment primary key, you cant have any other field in its primary key. Makes sense. Actually, I was just copying what someone else gave me and adding the auto_increment, then I got to

Re: Two Primary Keys

2010-06-29 Thread Victor Subervi
2010/6/29 João Cândido de Souza Neto j...@consultorweb.cnt.br I think the best, or may be the right way is to use picture_id as primary key and a unique index to product_sku. Yes, sounds good. So the purpose, then, is to speed lookups on fields commonly accessed. I'd forgotten that. Thanks, V

Foreign Key Problem

2010-06-22 Thread Victor Subervi
Hi; mysql alter table Flights type=InnoDB; Query OK, 1 row affected, 1 warning (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql alter table Flights add pilot_id int not null; Query OK, 1 row affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql alter table Flights add foreign

Re: Foreign Key Problem

2010-06-22 Thread Victor Subervi
Problem solved. I tried everything that *should* have worked and didn't. Then I just wiped the test database and started with everything *fixed* (all engine=innodb, all keys of same type, etc.) and it all worked. V

Re: Foreign Key Problem

2010-06-22 Thread Victor Subervi
On Tue, Jun 22, 2010 at 11:53 AM, jayabharath jbhara...@gmail.com wrote: Hi Victor, The actual problem is with the key field. Flights.pilot_id is set to INT NOT NULL and you had specified Pilots.id to INT NULL. You have to change both the columns to NULL or else NOT NULL to avoid the

Re: Foreign Key Problem

2010-05-22 Thread Victor Subervi
This is just for the sake of future googlers of this thread. The correct mysql command is: ursor.execute('create table if not exists Passengers (id int(11) auto_increment primary key, flights_id int(11) not null, customer_id int(11) not null, foreign key (flights_id) references Flights (id),

Another Foreign Key Problem

2010-05-21 Thread Victor Subervi
Hi; When I try to execute this code from my Python script, I get this error: Traceback (most recent call last): File /var/www/html/creative.vi/clients/sea-flight/reservations/create_edit_bags3.py, line 38, in ? create_edit_bags3() File

Re: Another Foreign Key Problem

2010-05-21 Thread Victor Subervi
I'm canceling this thread. It belongs in the Python list. Sorry! V On Fri, May 21, 2010 at 1:24 PM, Victor Subervi victorsube...@gmail.comwrote: Hi; When I try to execute this code from my Python script, I get this error: Traceback (most recent call last): File /var/www/html/creative.vi

Re: Foreign Key Problem

2010-05-20 Thread Victor Subervi
On Wed, May 19, 2010 at 12:02 PM, Shawn Green shawn.l.gr...@oracle.comwrote: Victor Subervi wrote: On Wed, May 19, 2010 at 10:59 AM, Shawn Green shawn.l.gr...@oracle.com wrote: Shawn Green wrote: look again closely at your FK definitions. The pattern should be FOREIGN KEY

Re: Foreign Key Problem

2010-05-19 Thread Victor Subervi
On Tue, May 18, 2010 at 2:23 PM, Shawn Green shawn.l.gr...@oracle.comwrote: Shawn Green wrote: I may be confused but how can the ID of the Passengers table be both the ID of the Flight they are taking and their Customer ID at the same time?

Re: Foreign Key Problem

2010-05-19 Thread Victor Subervi
On Wed, May 19, 2010 at 10:59 AM, Shawn Green shawn.l.gr...@oracle.comwrote: Shawn Green wrote: AH! that's your mistake. You think that creating the FK will also create the column. That does not happen. You have to define the table completely before you can associate the columns on this

Foreign Key Problem

2010-05-18 Thread Victor Subervi
Hi; mysql create table if not exists Passengers (id int unsigned auto_increment primary key, foreign key (id) references Flights (flights_id), foreign key (id) references Customers (customer_id), name varchar(40), weight tinyint(3)); Query OK, 0 rows affected (0.00 sec) mysql select c.first_name,

Re: Foreign Key Problem

2010-05-18 Thread Victor Subervi
apparently it didn't like my foreign key. Do I need to do something with the table I'm referencing or what? TIA, V On Tue, May 18, 2010 at 3:44 PM, Victor Subervi victorsube...@gmail.comwrote: Hi; mysql create table if not exists Passengers (id int unsigned auto_increment primary key, foreign

Re: Foreign Key Problem

2010-05-18 Thread Victor Subervi
On Tue, May 18, 2010 at 1:09 PM, Shawn Green shawn.l.gr...@oracle.comwrote: Johan De Meersman wrote: For additional details about failed FK attempts, check the error details in the SHOW INNODB STATUS report. I get this: 100518 10:26:22 Error in foreign key constraint of table

Re: tmp tables

2010-01-15 Thread Victor Subervi
On Thu, Jan 14, 2010 at 1:35 AM, Chris W 4rfv...@cox.net wrote: I think the reason the other poster was so harsh is because others have suggested the right way to do it, if not in a lot of detail, and you have just argued with them. I don't recall anyone doing that. I don't recall arguing. I

Re: tmp tables

2010-01-13 Thread Victor Subervi
On Mon, Jan 11, 2010 at 3:21 PM, mos mo...@fastmail.fm wrote: At 09:56 AM 1/11/2010, Johnny Withers wrote: Victor, The temporary table solution is not a good one. Use a single table and store each item put into a cart identified by the session ID of the user. A process should clean out

Re: tmp tables

2010-01-13 Thread Victor Subervi
On Wed, Jan 13, 2010 at 2:33 PM, Johnny Withers joh...@pixelated.netwrote: No one designs a shopping cart system this way. http://www.google.com/search?q=shopping+cart+database+table+design If you are dead set on this crazy design it doesn't matter if you put the temp tables in the main

Re: tmp tables

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 10:35 AM, Baron Schwartz ba...@xaprb.com wrote: Victor, On Sun, Jan 10, 2010 at 1:20 PM, Victor Subervi victorsube...@gmail.com wrote: Hi; I have a shopping cart that will spawn a tmp table for every shopping cart instance. Would it be better to create

Re: tmp tables

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 10:49 AM, Baron Schwartz ba...@xaprb.com wrote: Victor, That strikes me as messy. Each tmp table has as many rows as necessary for the products that are to be bough. To do as you say I would have to create a table with a zillion rows to accommodate however many

Re: tmp tables

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 11:38 AM, Keith Murphy bmur...@paragon-cs.comwrote: Victor, Don't want to butt in, and not trying to be rude, but he gave you advice. You don't seem inclined to take it. How else can he, or anyone else, help you? Clearly you don't understand some fundamental issue

tmp tables

2010-01-10 Thread Victor Subervi
Hi; I have a shopping cart that will spawn a tmp table for every shopping cart instance. Would it be better to create a separate database for these instead of having them in the same database as all the other tables for the shopping cart? TIA, Victor -- The Logos has come to bear

Re: Another Inserting Multiple Values with Set Problem

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 2:26 AM, Thiyaghu CK theyaho...@gmail.com wrote: Hi Victor, You have given space after the comma(shown here: ('Small, Medium, XSmall')). Take out the space and try, it will work. Example: mysql insert into products(sizes) values ('Small,Medium,small,medium'); Query

Re: Another Inserting Multiple Values with Set Problem

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 9:29 AM, Thiyaghu CK theyaho...@gmail.com wrote: Hi Victor, Take out the double quotes from[ ('Small,Medium,XSmall'), ('teal_E2725B,black_FF,yellow_9ACD32')]. Its working fine for me. mysql insert into products (sizes, colorsShadesNumbersShort)

Re: Another Inserting Multiple Values with Set Problem

2010-01-07 Thread Victor Subervi
OK, guys, I'm totally confused: mysql insert into products (SKU, Category, Name, Title, Description, Price, SortFactor, Availability, OutOfStock, Weight, ShipFlatFee, ShipPercentPrice, ShipPercentWeight, sizes, colorsShadesNumbersShort) values (prodSKU1, prodCat1, name1, title1, descr, 12.34,

Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
Hi; The following doesn't work with or without enclosing the sets in quotes: update products set SKU=prodSKU2, Category=prodCat1, Name=name2, Title=title2, Description=descr, Price=22.55, SortFactor=500, Availability=1, OutOfStock=0, Weight=5.5, ShipFlatFee=10.0, ShipPercentPrice=5,

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
there. No, that thew the same errors. I know you have to enclose the sets in parentheses and individually quote each element. V - michael dykman On Wed, Jan 6, 2010 at 9:32 AM, Victor Subervi victorsube...@gmail.com wrote: On Wed, Jan 6, 2010 at 10:23 AM, Michael Dykman mdyk...@gmail.com wrote

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 12:14 PM, Michael Dykman mdyk...@gmail.com wrote: so you dropped the quotes around the unneccessarily bracketed expression? It's hard to diagnose when your example isn't even what you think is syntactically correct. Here's my example again. Syntactically correct. From

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:18 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Wed, Jan 6, 2010 at 11:39 AM, Victor Subervi victorsube...@gmail.com wrote: Here's my example again. Syntactically correct. From my original post: update products set SKU=prodSKU2, Category=prodCat1

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:34 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Wed, Jan 6, 2010 at 1:25 PM, Victor Subervi victorsube...@gmail.com wrote: mysql update products set SKU=prodSKU2, Category=prodCat1, Name=name2, Title=title2, Description=descr, Price=22.55

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:40 PM, Michael Dykman mdyk...@gmail.com wrote: How about you show us the schema for the table so we know what is defined as what? Done in last email. Also, as the update does succeed, it would be interesting to see what value actually got stored. After you have

Re: How Set Up This Table

2010-01-04 Thread Victor Subervi
On Mon, Jan 4, 2010 at 10:40 AM, Arthur Fuller fuller.art...@gmail.comwrote: The ProductPackages table is what is known as an associate table, and is used to implement a many-to-many relationship. You only need it if a given product can be in multiple packages. If not, then you can eliminate

Re: How Set Up This Table

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 11:20 AM, Arthur Fuller fuller.art...@gmail.comwrote: Hi Victor. I think that the first thing you need to consider is whether a product can be in more than one package, and second is whether a package can be in another package. Also, I don't know why you need to

Re: How Set Up This Table

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 12:03 PM, prabhat kumar aim.prab...@gmail.comwrote: primary key Oh! PK is primary key! a compound key is a key that consists of 2 or more attributes that uniquely identify an entity occurrence. Thanks. V

Re: How Set Up This Table

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 11:20 AM, Arthur Fuller fuller.art...@gmail.comwrote: Hi Victor. I think that the first thing you need to consider is whether a product can be in more than one package, and second is whether a package can be in another package. Also, I don't know why you need to

How Set Up This Table

2010-01-01 Thread Victor Subervi
Hi; I have a table with products for a store to sell. I need to autogenerate from code a table or series of tables into which I can enter (and from which I can retrieve) the ID numbers of products which I am going to associate together and their package price. Product associations will vary, in

Inserting Multiple Values with Set

2010-01-01 Thread Victor Subervi
Hi; mysql describe products; +--+---+--+-+-++ | Field| Type | Null | Key |

Re: Inserting Multiple Values with Set

2010-01-01 Thread Victor Subervi
On Fri, Jan 1, 2010 at 4:34 PM, Don Read don_r...@att.net wrote: On Fri, 1 Jan 2010 14:34:48 -0500 Victor Subervi said: Hi; snip The following insert chokes when I try to insert multiple values from the sets: insert into products (SKU, Category, Name, Title, Description, Price

last_insert_id

2009-12-27 Thread Victor Subervi
Hi; mysql select * from products;

Re: last_insert_id

2009-12-27 Thread Victor Subervi
On Sun, Dec 27, 2009 at 11:27 AM, Mattia Merzi mattia.me...@gmail.comwrote: 2009/12/27 Victor Subervi victorsube...@gmail.com: mysql select * from products; [...] mysql select last_insert_id() from products; [...] Now, I was expecting 1, not 0! What up? [...] LAST_INSERT_ID

Re: last_insert_id

2009-12-27 Thread Victor Subervi
On Sun, Dec 27, 2009 at 12:00 PM, Michael Dykman mdyk...@gmail.com wrote: last_insert_id() returns the last id auto-incremented in *the current session*. If you disconnect and reconnect, it can not be retrieved. Ahah! So how do I retrieve the last id inserted irrespective of connection? TIA,

Re: last_insert_id

2009-12-27 Thread Victor Subervi
On Sun, Dec 27, 2009 at 1:30 PM, Gary Smith li...@l33t-d00d.co.uk wrote: Victor Subervi wrote: On Sun, Dec 27, 2009 at 12:00 PM, Michael Dykman mdyk...@gmail.com wrote: last_insert_id() returns the last id auto-incremented in *the current session*. If you disconnect and reconnect

Join Statement

2009-12-14 Thread Victor Subervi
Hi; I have the following: mysql select SKU, Quantity, Name, Price, p.sizes, p.colorsShadesNumbersShort from tem126080739853 t join products p on t.ProdID-p.ID; Empty set (0.00 sec) mysql select * from tem126080739853; +++--+-+--+ | ID |

Re: Join Statement

2009-12-14 Thread Victor Subervi
On Mon, Dec 14, 2009 at 12:37 PM, Peter Brawley peter.braw...@earthlink.net wrote: ... on t.ProdID-p.ID; Your join clause subtracts the two IDs, so it's on IDs that differ, and apparently there aren't any. I beg to differ: mysql select SKU, Quantity, Name, Price, p.sizes,

Re: Join Statement

2009-12-14 Thread Victor Subervi
On Mon, Dec 14, 2009 at 1:04 PM, Peter Brawley peter.braw...@earthlink.netwrote: ...on t.ProdID-p.ID... _subtracts_ the two IDs. To match them use '=' rather than '-'. Thank you for all of you that caught that. V

Duplicate Entry, But Table Empty!

2009-12-13 Thread Victor Subervi
Hi; mysql insert into tem126072414516 (ProdID, Quantity) values (2, 2); ERROR 1062 (23000): Duplicate entry '2' for key 2 mysql select * from tem126072385457; Empty set (0.00 sec) mysql describe tem126072385457; +--+-+--+-+-++ | Field|

Re: Duplicate Entry, But Table Empty!

2009-12-13 Thread Victor Subervi
On Sun, Dec 13, 2009 at 12:21 PM, Pinter Tibor tib...@tibyke.hu wrote: Victor Subervi wrote: Hi; mysql insert into *tem126072414516* (ProdID, Quantity) values (2, 2); mysql select * from *tem126072385457*; mysql insert into *tem126072414516* (ProdID, Quantity) values (2, 2); ERROR 1064

inserting sets of data

2009-12-12 Thread Victor Subervi
Hi; I have a column defined as a set. How do I insert data into that column? Please give me an example. TIA, Victor

Re: inserting sets of data

2009-12-12 Thread Victor Subervi
On Sat, Dec 12, 2009 at 10:58 AM, David Giragosian dgiragos...@gmail.comwrote: On Sat, Dec 12, 2009 at 9:54 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have a column defined as a set. How do I insert data into that column? Please give me an example. TIA, Victor Lots

Update Doesn't Update!

2009-12-11 Thread Victor Subervi
Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql select sizes, colorsShadesNumbersShort from products where ID=0; +---+--+ | sizes |

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 4:48 AM, Jørn Dahl-Stamnes sq...@dahl-stamnes.netwrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 4:48 AM, Jørn Dahl-Stamnes sq...@dahl-stamnes.netwrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 4:43 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 04:38:01 -0500, Victor Subervi victorsube...@gmail.com wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 5:13 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi victorsube...@gmail.com wrote: mysql update products set sizes=('Small', 'Large') where SKU='prodSKU1'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 5:33 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 05:28:41 -0500, Victor Subervi victorsube...@gmail.com wrote: On Fri, Dec 11, 2009 at 5:13 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi victorsube...@gmail.com

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 8:43 AM, Johan De Meersman vegiv...@tuxera.bewrote: On Fri, Dec 11, 2009 at 11:19 AM, Mark Goodge m...@good-stuff.co.uk wrote: Jørn Dahl-Stamnes wrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small

Re: Select Problem

2009-12-07 Thread Victor Subervi
On Sun, Dec 6, 2009 at 2:42 PM, Steve Edberg edb...@edberg-online.comwrote: At 1:26 PM -0500 12/6/09, Victor Subervi wrote: Hi; I have the following: mysql select * from categoriesProducts as c inner join relationshipProducts as r on c.ID = r.Child inner join categoriesProducts as p

Second Request: Challenging Select Statement

2009-12-07 Thread Victor Subervi
Hi; I posted this Saturday. Perhaps it's too challenging for those who read it to answer. I hope someone can. I need to write a select statement that enables me to select column 'ID' from a table where a certain value is found in an enum of a specific column. For example... select column_type

Re: Second Request: Challenging Select Statement

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 8:08 AM, Tom Worster f...@thefsb.org wrote: On 12/7/09 5:26 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; I posted this Saturday. Perhaps it's too challenging for those who read it to answer. I hope someone can. I need to write a select statement

Select Problem

2009-12-06 Thread Victor Subervi
Hi; I have the following: mysql select * from categoriesProducts as c inner join relationshipProducts as r on c.ID = r.Child inner join categoriesProducts as p on r.Parent = p.ID where p.Category = prodCat2; ERROR 1054 (42S22): Unknown column 'prodCat2' in 'where clause' mysql describe

Like Syntax

2009-12-05 Thread Victor Subervi
Hi; I remember vaguely how to do this but don't know how to google it: show tables like categories$; such that it will return tables such as: categoriesProducts, categoriesPrescriptions, etc. TIA, Victor

Re: Like Syntax

2009-12-05 Thread Victor Subervi
On Sat, Dec 5, 2009 at 11:09 AM, Michael Dykman mdyk...@gmail.com wrote: show tables like 'categories%'; Thanks. V

Challenging Select Statement

2009-12-05 Thread Victor Subervi
Hi; I need to write a select statement that enables me to select column 'ID' from a table where a certain value is found in an enum of a specific column. For example... select column_type from information_schema.columns where table_name='products' and column_name='Categories'; will give me the

Auto Increment Problem

2009-12-05 Thread Victor Subervi
Hi; mysql insert into categories (Category, Parent) values ('test', NULL); ERROR 1062 (23000): Duplicate entry '0' for key 1 mysql describe categories; +--+-+--+-+-+---+ | Field| Type| Null | Key | Default | Extra |

Re: Auto Increment Problem

2009-12-05 Thread Victor Subervi
Oops. Never mind. V On Sat, Dec 5, 2009 at 1:19 PM, Victor Subervi victorsube...@gmail.comwrote: Hi; mysql insert into categories (Category, Parent) values ('test', NULL); ERROR 1062 (23000): Duplicate entry '0' for key 1 mysql describe categories

Creating Table Through Union

2009-11-22 Thread Victor Subervi
Hi; I would like to create a table out of merging the fields in other, previously created tables. I have the following syntax which doesn't work: create table products union (b0basics, b0fieldValues, s0prescriptions, s0prescriptions0doctors, s0prescriptions0patient, pics); Please advise. TIA,

Re: Creating Table Through Union

2009-11-22 Thread Victor Subervi
On Sun, Nov 22, 2009 at 9:29 PM, Gavin Towey gto...@ffn.com wrote: The form would be like: CREATE TABLE products SELECT b0basics, b0fieldValues, s0prescriptions, s0prescriptions0doctors, s0prescriptions0patient, pics FROM table1 UNION SELECT b0basics, b0fieldValues, s0prescriptions,

Re: Foreign Keys Problem

2009-11-20 Thread Victor Subervi
On Thu, Nov 19, 2009 at 9:34 PM, Ye Yuan yuan4...@gmail.com wrote: Hi Victor, It looks to me the foreign key syntax is wrong. Can you create the Relationship table on your database by using below ddl? create table if not exists Relationship (ID integer auto_increment primary key, Parent

Foreign Keys Problem

2009-11-19 Thread Victor Subervi
Hi; I don't claim to be an expert in MySQL. The following code was largely supplied to me by someone who was. I don't really understand foreign keys. He wrote this off the top of his head, and it's throwing an error. Here's the python code: def catTree(): user, passwd, db, host = login()

Grant Privileges Problem

2009-11-09 Thread Victor Subervi
Hi; I created a user and then granted privileges: grant all to victor identified by 'pw'; Looked good. Tried to log in as victor an no go. Please advise. Victor

Re: Grant Privileges Problem

2009-11-09 Thread Victor Subervi
Never mind. Had to add @'localhost' On Mon, Nov 9, 2009 at 4:20 PM, Victor Subervi victorsube...@gmail.comwrote: Hi; I created a user and then granted privileges: grant all to victor identified by 'pw'; Looked good. Tried to log in as victor an no go. Please advise. Victor

Re: Inserting an Image

2009-10-16 Thread Victor Subervi
/index.php?title=Storing_files_in_the_database Regards, Gavin Towey -Original Message- From: Victor Subervi [mailto:victorsube...@gmail.com] Sent: Thursday, October 15, 2009 12:05 PM To: mysql@lists.mysql.com Subject: Inserting an Image Hi; I have successfully inserted

Inserting an Image

2009-10-15 Thread Victor Subervi
Hi; I have successfully inserted images, like yesterday, before into MySQL with the following code: sql = 'update productsX set pic1=%s where ID=2;' % pic1 cursor.execute(sql) where pic1 is simply an image uploaded through a form then sent over without any alteration to another

Re: No tuples, but AttributeError about tuple!

2009-10-05 Thread Victor Subervi
4, 2009 at 2:04 PM, Victor Subervi victorsube...@gmail.com wrote: Hi; I have the following python code: sql = 'insert into products values(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);', (id, name, title, description, price, bedrooms, bathrooms

Re: No tuples, but AttributeError about tuple!

2009-10-05 Thread Victor Subervi
) values('1', 'name1', 'title1', 'descr1', '1.1', '2', '1', 'New', '1.5', 'new', 'princesse', 'princesse', '123 princesse', 'Not furnished', '', '', '', '', '', ''); Values are enclosed in single quotes for SQL. - Original Message - From: Victor Subervi victorsube...@gmail.com

No tuples, but AttributeError about tuple!

2009-10-04 Thread Victor Subervi
Hi; I have the following python code: sql = 'insert into products values(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);', (id, name, title, description, price, bedrooms, bathrooms, conditions, acreage, construction, location, estate, address, furnished,

Re: Nested Joins

2009-10-02 Thread Victor Subervi
*From:* Victor Subervi [mailto:victorsube...@gmail.com] *Sent:* Thursday, October 01, 2009 3:04 PM *To:* Gavin Towey; mysql@lists.mysql.com *Subject:* Re: Nested Joins Well, your syntax is *exactly* what I had (with a few cosmetic changes). I've been over the MySQL manual on joins

Another Join Problem

2009-10-02 Thread Victor Subervi
Hi; I get the following error: *SQL query:* SELECT ID, Item FROM products JOIN categories ON categories.ID = products.Category LIMIT 0 , 30; *MySQL said:* #1052 - Column 'ID' in field list is ambiguous Please note the error is about ambiguity. products has an ID field and so does categories.

Re: Another Join Problem

2009-10-02 Thread Victor Subervi
Thanks V On Fri, Oct 2, 2009 at 11:08 AM, Mark Goodge m...@good-stuff.co.uk wrote: Victor Subervi wrote: Hi; I get the following error: *SQL query:* SELECT ID, Item FROM products JOIN categories ON categories.ID = products.Category LIMIT 0 , 30; *MySQL said:* #1052 - Column 'ID

Nested Joins

2009-10-01 Thread Victor Subervi
Hi; I'm new to join statements. Here's my python syntax: cursor.execute('select * from %s left join products on %s.Item=products.Item (left join categories on products.Category=categories.ID);' % (client, client)) I believe it's clear how I want to nest, but I don't know how to repair my

Re: Nested Joins

2009-10-01 Thread Victor Subervi
On Thu, Oct 1, 2009 at 4:03 PM, Gavin Towey gto...@ffn.com wrote: Joins aren't nested like that, unless you use a subquery. I think you just need to remove the parens around the second join. I tried that and no go :( For better help: 1. show the real SQL -- echo the statement. Most

Re: Nested Joins

2009-10-01 Thread Victor Subervi
/articles/mysql-db-design-ch5.pdf http://dev.mysql.com/doc/refman/5.1/en/join.html Regards, Gavin Towey *From:* Victor Subervi [mailto:victorsube...@gmail.com] *Sent:* Thursday, October 01, 2009 2:25 PM *To:* Gavin Towey; mysql@lists.mysql.com *Subject:* Re: Nested Joins On Thu, Oct

Create Syntax (easy)

2009-09-29 Thread Victor Subervi
Hi; Please give me the syntax below such that I can force the insert statements to use only selected values (item1, item2, item3): create table (field SOMETHING_HERE item1 item2 item3, ... ) TIA, Victor

Re: Create Syntax (easy)

2009-09-29 Thread Victor Subervi
That's it! Thanks, V On Tue, Sep 29, 2009 at 12:13 PM, David Giragosian dgiragos...@gmail.comwrote: On Tue, Sep 29, 2009 at 11:09 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; Please give me the syntax below such that I can force the insert statements to use only selected

Problem w/ mysqldump

2009-09-02 Thread Victor Subervi
Hi: I have the following python code: import os os.system(mysqldump -u root -pPASSWORD --opt spreadsheets dump.sql) This nicely creates the file...but the file is empty! The database exists and has lots of data, I double-checked it. If there is nothing wrong with my code, is there some way to do

Re: Problem w/ mysqldump

2009-09-02 Thread Victor Subervi
- From: news [mailto:n...@ger.gmane.org] On Behalf Of Emile van Sebille Sent: Wednesday, September 02, 2009 7:18 AM To: mysql@lists.mysql.com Cc: python-l...@python.org Subject: Re: Problem w/ mysqldump On 9/2/2009 3:43 AM Victor Subervi said... Hi: I have the following python

Re: Problem w/ mysqldump

2009-09-02 Thread Victor Subervi
for a mysql dump tool ;-) Mysql dump is the better way to go in either situation. -Original Message- From: Victor Subervi [mailto:victorsube...@gmail.com] Sent: Wednesday, September 02, 2009 1:43 PM To: Daevid Vincent; mysql@lists.mysql.com Subject: Re: Problem w/ mysqldump I

Re: Suppressing Warnings

2009-08-31 Thread Victor Subervi
'; database exists This is the answer. 2009/8/24 Victor Subervi victorsube...@gmail.com Hi, I have the following python code: cursor.execute('create database if not exists spreadsheets;') cursor.execute('use spreadsheets;') but it generates this warning: Warning (from warnings module): File

Suppressing Warnings

2009-08-24 Thread Victor Subervi
Hi, I have the following python code: cursor.execute('create database if not exists spreadsheets;') cursor.execute('use spreadsheets;') but it generates this warning: Warning (from warnings module): File C:\Python25\mysqlConverter.py, line 140 cursor.execute('use spreadsheets;')

Update Syntax

2009-07-26 Thread Victor Subervi
Hi; I would like to test the following: update maps set map where site=mysite; to see if there is such an entry in maps. If there is, then update. If there is not, then I would like to execute an insert statement. How do I do that? TIA, Victor

  1   2   >