Re: how do you increment a field on the fly?
How do you add a column that increments on the fly those fields you've selected to print in a mysql query? Example: select count(g.Group_ID) as Number, g.Description, sum(i.Retail_Value) from Groups g, Item i where i.Group_ID = g.Group_ID and i.Group_ID 0 group by i.Group_ID order by i.Category_ID; My intention was to have the Number field simple be a number that increments by one for each line that prints out. But, of course, the documentation says that's not what the count function is for. How can I add a simple little old line counter? -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= I put instant coffee in a microwave and almost went back in time. -- Steven Wright -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= I'm not afraid of death -- I just don't want to be there when it happens. -- Woody Allen - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
group_ID not accepted
I try to create a table called group. I get an error saying: 'You have an error in your SQL syntax near 'Group (Group_ID TINYINT(3) NOT NULL AUTO_INCREMENT PRIMARY KEY)' at line 1. What's wrong with this? TIA -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= If you live to the age of a hundred you have it made because very few people die past the age of a hundred. -- George Burns - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
MySQL and 3NF
Hi, I came across a relationship between entities that I hadn't counted on, and I'm trying to adjust my database tables to handle this new relationship. I need some help with visualizing and implementing this relationship into the database design. The database is for an inventory of contributions to be auctioned off for a Montessori school. Here are my tables: mysql show tables; +--+ | Tables in vmscatalog | +--+ | Category | | Contact | | Contributors | | Delivery | | Groups | | Item | | Volunteer| +--+ I've assumed that each contributor (business, individual, whatever) would have only one volunteer from the Montessori school that they would be dealing with. so I've got the following structure for the contributors table: mysql describe Contributors; ++--+--+-+-++ | Field | Type | Null | Key | Default | Extra | ++--+--+-+-++ | Contributor_ID | tinyint(3) | | PRI | 0 | auto_increment | | Name | varchar(100) | | | | | | Street_Address | varchar(50) | YES | | NULL| | | City | varchar(20) | YES | | NULL| | | State | varchar(5) | YES | | NULL| | | Zip| mediumint(8) | YES | | NULL| | | Contact_ID | tinyint(3) | YES | | NULL| | | Volunteer_ID | tinyint(3) | YES | | NULL| | ++--+--+-+-++ 8 rows in set (0.01 sec) Likewise, the Volunteer_ID ties in with a Volunteer table and a unique row in the volunteer table. Now I've got a situation where a large Museum actually has two people from the school each talking to different departments in the Museum, each donating a different set of gift certificates. So I have to figure out some way to let the contributors' table handle more than Contact_ID and more than one Volunteer_ID. Don't I want each Contact_ID field for each record to be a single discrete ID number? How would you guys handle this? TIA! -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= It's hard to get ivory in Africa, but in Alabama the Tuscaloosa. -- Groucho Marx - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
printing camera-ready mysql report
Hi, I'm just starting my first MySQL db, and I'm going to want to print out reports from it and produce a camera-ready document. Has anyone done this before, using, say, Star Office or AbiWord or something? TIA. -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= I used to work in a fire hydrant factory. You couldn't park anywhere near the place. -- Steven Wright - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
MySQL undo?
Hi, I did a really dumb thing. I went update Tablename set Name = 'Joe Bloe' instead of update Tablename set Name = 'Joe Bloe' where ID = 5. Now all the Name records in Tablename = 'Joe Blow' Damn. I can't believe I did that, but it was a slip of the hand. Is there any easy way to recover that information? Is there an undo command? -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= You can't have everything. Where would you put it? -- Steven Wright - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
foreign key?
Hi, I'm trying to update the values of Contact_ID and Volunteer_ID in a table called Contributors. The layout for Contributors is ++--+--+-+-++ | Field | Type | Null | Key | Default | Extra | ++--+--+-+-++ | Contributor_ID | tinyint(3) | | PRI | 0 | auto_increment | | Name | varchar(100) | | | | | | Street_Address | varchar(50) | YES | | NULL| | | City | varchar(20) | YES | | NULL| | | State | varchar(5) | YES | | NULL| | | Zip| mediumint(8) | YES | | NULL| | | Contact_ID | tinyint(3) | YES | | NULL| | | Volunteer_ID | tinyint(3) | YES | | NULL| | ++--+--+-+-++ I'm using the command: update Contributors set Contact_ID = 1, Volunteer_ID = '13' where Name = Somebody Lastname; After having issued the command, I get Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0 But then when I select * in Contributors where Name = Somebody Lastname; The values haven't been updated. They remain 0 and 0. What gives? Is this a foreign key problem? TIA. PS. Oh yeah, I'm using mysql 3.22 on debian 2.2. -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The other day I... uh, no, that wasn't me. -- Steven Wright - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: foreign key?
On Fri, Jan 25, 2002 at 12:33:59PM -0500 Gurhan Ozen [EMAIL PROTECTED] wrote: Hi David, First of all, whever you have a primary key on your table, do all updates according to the primary key.. So whatever the primary key for the person you wanna do update, do something like: update Contributors set Contact_ID = 1, Volunteer_ID = 13 where Contributor_ID=number; Also since the columns are integer data type, don't use quotes around them. I hope this helps.. Yep, I removed the quotes, and it worked. Here's another problem: I think I'm doing an unintentional ambiguous select: mysql select Item.Item_Description, Item.Retail_Value, Item.Bid_Description, Contributors.Name from Item, Contributors where Contributor_ID 1; I get the error: ERROR 1052: Column: 'Contributor_ID' in where clause is ambiguous So, looking again at my definitions for Contributor_ID in both tables, I see they aren't exactly alike. Is there a way I can make Contributor_ID in Item refer back to the Index (Contributor_ID) in Contributors? I gather that just making the data types the same is not enough? TIA! -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= I'm going to live forever, or die trying! -- Spider Robinson - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Premature end of script
Hi, I'm trying to use phpmyadmin 2.2.3 on a debian 2.2 box with Mysql 3.22.32, php 3.0.18, and apache 1.3.9-14. After installing phpmyadmin per Documentation.txt and creating the standard user, I get a premature end of script headers: /usr/lib/cgi-bin/phpadmin/index.php3 This is from the /var/log/apache/error.log file. Any ideas what might be going wrong? TIA. -- David S. Jackson[EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Nirvana? That's the place where the powers that be and their friends hang out. -- Zonker Harris - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php