help with query

2006-02-21 Thread xtcsuk
3 tables: table1 - table2 (one to many) table2 - table3 (one to one) [designed like this] how to achieve this? select table1.*, table2.*, table3.*, sum(table2.field3), sum(table2.field4) from table1, table2, table3 where table1.field1 = table2.field1 and table2.field1 = table3.field1 regards

Re: Change on LEFT JOIN ON syntax in 5.x?

2006-02-21 Thread Jan Pieter Kunst
On 2/20/06, Eric Persson [EMAIL PROTECTED] wrote: Hi, I have a query which works fine for me in my 4.1 environment, but when moved to the 5.0.18 environment, it fails with the result below: mysql SELECT r.uid, u.username, u.image_type, count(id) AS antal, s.timestamp FROM recruits_uid r,

MySQL Certification Questions

2006-02-21 Thread Adrian Bruce
Hi Does anybody know where i can get a load of sample questiosn for the MySQL certificate exams, i know there are a few on mysql's site but i was hoping to find quite a few to practice on. Thanks Ade -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

RE: mysqlimport, \r\n and \n

2006-02-21 Thread George Law
Daniel, What about just running your import file through dos2unix before piping it to mysql? That way, it would leave \n alone (since that is unix format) and replace any occurrances of \r\n with plan old \n. -- George -Original Message- From: Daniel Kasak [mailto:[EMAIL

Re: Change on LEFT JOIN ON syntax in 5.x?

2006-02-21 Thread SGreen
Jan Pieter Kunst [EMAIL PROTECTED] wrote on 02/21/2006 04:54:46 AM: On 2/20/06, Eric Persson [EMAIL PROTECTED] wrote: Hi, I have a query which works fine for me in my 4.1 environment, but when moved to the 5.0.18 environment, it fails with the result below: mysql SELECT r.uid,

Re: How to turn off all constraints in a table?

2006-02-21 Thread SGreen
Easier than that (though Sheeri's way would work): ALTER TABLE yourtablename DISABLE KEYS; SET FOREIGN_KEY_CHECKS=0; ... do your processing ... SET FOREIGN_KEY_CHECKS=1; ALTER TABLE yourtablename ENABLE KEYS; http://dev.mysql.com/doc/refman/5.0/en/alter-table.html

Re: (mysqldump) Serial output. . .?

2006-02-21 Thread SGreen
Michael, I have been following this thread from the beginning and I just don't see the practical difference between what you propose and the replication methods (SBR and RBR) already in place. How does what you propose differ from the SBR (statement -based replication) that MySQL already

Re: How to turn off all constraints in a table?

2006-02-21 Thread SGreen
Once CHECK CONSTRAINTS are enabled, I am sure there will be a way to turn them off temporarily. Right now, you can create tables that have them but they are not enforced. To quote http://dev.mysql.com/doc/refman/5.0/en/create-table.html InnoDB tables support checking of foreign key

Re: help with query

2006-02-21 Thread Peter Brawley
how to achieve this? select table1.*, table2.*, table3.*, sum(table2.field3), sum(table2.field4) from table1, table2, table3 where table1.field1 = table2.field1 and table2.field1 = table3.field1 Your question as formulated has no answer. If you query aggregate values like Sum on a table, you

Re: (mysqldump) Serial output. . .?

2006-02-21 Thread mwilliams
Shawn, Thanks for the reply, but I think the thread has become much more dramatic than nececessary. Basically, I'm not looking for what has been ALTERed. I simply need the table creation data output in ALTER IGNORE (or whatever is appropriate) format so as to ensure table structure is the

Different result with subquery

2006-02-21 Thread neroux
Hello, I am having a table with an integer column which I use for probability calculations (the higher a value the more often it is chosen). Now I am having the following query, which should actually incorporate these probabilities, however it seems to prefer values from the middle range

Re: (mysqldump) Serial output. . .?

2006-02-21 Thread SGreen
One problem with dual-master or multi-master replication is that you have to be able to set and check a lock across all masters before performing a schema change. How would you deal with this scenario using your ALTER TABLE database dumps without such a lock? Server A and B share a table X

Re: (mysqldump) Serial output. . .?

2006-02-21 Thread mwilliams
Ah, well, in this particular DB, *every single transaction* it's it's own entry. . .basically the DB itself is a binary log. . .kinda. . .sorta. So the current value of a particular item isn't necessarily an issue since, once entered, it will always be the same. A change to that value will in

mysqldump: invalid option -- Q

2006-02-21 Thread koea
Hi, list! I'm facing some porblems with mysqldump. Here is it: [EMAIL PROTECTED] ~] mysqldump --help | grep -- -Q -Q, --quote-names Quote table and column names with ` [EMAIL PROTECTED] ~] mysqldump -Q -u -p -h dbname dump.sql mysqldump: invalid option -- Q Am I doing

Re: mysqldump: invalid option -- Q

2006-02-21 Thread Paul DuBois
At 21:22 +0300 2/21/06, [EMAIL PROTECTED] wrote: Hi, list! I'm facing some porblems with mysqldump. Here is it: [EMAIL PROTECTED] ~] mysqldump --help | grep -- -Q -Q, --quote-names Quote table and column names with ` [EMAIL PROTECTED] ~] mysqldump -Q -u -p -h dbname

Re: (mysqldump) Serial output. . .?

2006-02-21 Thread SGreen
Ok, I get that. I have several tables just like that (I use mine as shadow tables for change audits. Every change to the normal table ends up creating new record in the shadow table thus documenting each state of the normal table through time). However, shouldn't schema changes be very rare

Re: (mysqldump) Serial output. . .?

2006-02-21 Thread mwilliams
Yes, schema changes would/should be rare. You may be right, but I would think that since schema information is *alway* checked before any INSERTS then we should be good. There should never be an occasion to break per se. Obviously anything can happen, and appropriate recovery methods (e.g.

confused...

2006-02-21 Thread Patrick Duda
Why, when I create a table as follows: mysql create table requestid ( request_id int not null default 1, constraint requestid_innodb_pk_cons primary key(request_id) ) ENGINE=InnoDB; Query OK, 0 rows affected (0.02 sec) Do I get the following? mysql select request_id from requestid;

Re: Different result with subquery

2006-02-21 Thread Peter Brawley
Neroux, RAND() gives a roughly rectangular distribution, not a normal distribution, so samples of fewer than 100 or so values from it are likely to show large but statistically _insignificant_ differences. In larger samples, I don't see any tendency of RAND() to produce more values near its

Re: confused...

2006-02-21 Thread Hugh Sasse
On Tue, 21 Feb 2006, Patrick Duda wrote: Why, when I create a table as follows: mysql create table requestid ( request_id int not null default 1, constraint requestid_innodb_pk_cons primary key(request_id) ) ENGINE=InnoDB; Query OK, 0 rows affected (0.02 sec) Defines the properties of

Re: confused...

2006-02-21 Thread SGreen
Patrick Duda [EMAIL PROTECTED] wrote on 02/21/2006 02:39:47 PM: Why, when I create a table as follows: mysql create table requestid ( request_id int not null default 1, constraint requestid_innodb_pk_cons primary key(request_id) ) ENGINE=InnoDB; Query OK, 0 rows affected (0.02

JOINs with result of aggregate function fails with error #1054

2006-02-21 Thread Guillaume Boissiere
This must have been asked before but I could not find the answer searching the list archives. I have a simple table: CREATE TABLE `license` ( `id` int(11) NOT NULL auto_increment, `firstname` varchar(100) NOT NULL default '', `lastname` varchar(100) NOT NULL default '', `host_address`

Re: confused...

2006-02-21 Thread Peter Brawley
Patrick, Shouldn't I be getting back a '1' when I do my select??? Why am I getting an empty set? First, creating a table doesn't add any rows. Show Create Table ... returns a row of data definition info, not a row of table data. Second, Defining the column as NOT NULL will require numeric

Re: JOINs with result of aggregate function fails with error #1054

2006-02-21 Thread gerald_clark
Guillaume Boissiere wrote: This must have been asked before but I could not find the answer searching the list archives. I have a simple table: CREATE TABLE `license` ( `id` int(11) NOT NULL auto_increment, `firstname` varchar(100) NOT NULL default '', `lastname` varchar(100) NOT NULL

Re: JOINs with result of aggregate function fails with error #1054

2006-02-21 Thread SGreen
Guillaume Boissiere [EMAIL PROTECTED] wrote on 02/21/2006 02:23:29 PM: This must have been asked before but I could not find the answer searching the list archives. I have a simple table: CREATE TABLE `license` ( `id` int(11) NOT NULL auto_increment, `firstname` varchar(100) NOT NULL

Re: mysqldump command

2006-02-21 Thread sheeri kritzer
I'm assuming you're doing this as root (hence the # sign). The way to debug this, as with any script, is to run it manually on the command line and see what errors you get. So if you run the following, what happens? mysqldump --opt -c -C dp /var/tmp_save/dproject.sql (not sure if you ran that

Creating a Web Database Search Application

2006-02-21 Thread Douglas S. Davis
Hello, I commonly create webpages that need to search through a MySQL database and then display the results to the user. An example would be a database that contains the following: first name last name age gender location job interests I usually create a webpage with a combination of drop

Re: mysqlimport, \r\n and \n

2006-02-21 Thread Daniel Kasak
George Law wrote: Daniel, What about just running your import file through dos2unix before piping it to mysql? That way, it would leave \n alone (since that is unix format) and replace any occurrances of \r\n with plan old \n. I could think of a lot of things I could do if this were all

Re: mysqlimport, \r\n and \n

2006-02-21 Thread SGreen
A little less dodgy is to write a VBA routine within Access to do the filtering. Alternatively, if you don't want to trust access to do it, you can write a VBScript or JScript routine and run it through the shell (yes, Windoze has shell scripts, too) There are all kinds of things you can do.

Re: Creating a Web Database Search Application

2006-02-21 Thread Jonathan Mangin
- Original Message - From: Douglas S. Davis [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, February 21, 2006 3:58 PM Subject: Creating a Web Database Search Application Hello, I commonly create webpages that need to search through a MySQL database and then display the

Re: Creating a Web Database Search Application

2006-02-21 Thread Jonathan Mangin
- Original Message - From: Douglas S. Davis [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, February 21, 2006 3:58 PM Subject: Creating a Web Database Search Application Hello, I commonly create webpages that need to search through a MySQL database and then display the

Re: Different result with subquery

2006-02-21 Thread neroux
Hello Peter, thanks for your reply, however my question was less related to RAND() but more about the weird situation that the results are more or less fine with the two queries, however different when they are combined into one query with a subquery. Thanks --- Peter Brawley [EMAIL PROTECTED]

parameterized view ?

2006-02-21 Thread Laszlo Nadai
Is there such a thing in mySQL ? I could not find anything anywhere. thanks, laszlo

dropping a database to reclaim space

2006-02-21 Thread Luke Vanderfluit
Hi. I have a database that is fairly large and I'm doing some testing with 2 different mysql packages, one 32-bit, one 64bit, for comparison's sake. Now I've finished with one of the dbs and I want to reclaim the disk space. I've tried deleting a few (large) tables from the database,

Re: MySQL Certification Questions

2006-02-21 Thread Ligaya Turmelle
the study guide? Adrian Bruce wrote: Hi Does anybody know where i can get a load of sample questiosn for the MySQL certificate exams, i know there are a few on mysql's site but i was hoping to find quite a few to practice on. Thanks Ade -- life is a game... so have fun. -- MySQL

Nested Set Model or modified preorder tree traversal mySQL/PHP code wanted

2006-02-21 Thread Daevid Vincent
I've been searching the web for the past few hours trying to find a simple drop-in class or functions to implement Nested Set Model or modified preorder tree traversal. I've found several tutorials and related links: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

Re: Creating a Web Database Search Application

2006-02-21 Thread BÁRTHÁZI András
Hi, With so few fields, sticking with one report isn't out of the question. Don't know if you're using this technique: my $lname = $q-param('lname') || '%'; So all fields not filled/selected by the user are wildcards by default. A completely empty form pulls all data in the relevant tables.

Re: next, prev, records in MySql. Handler Function

2006-02-21 Thread Alvaro Cobo
Thanks Sheeri: Yes, you where right. It was because I was not opening the table first. Actually, I was using this statements from a MySQL GUI (MySQL Query Browser) so it doesn't work in this program (it doesn't keeps the table opened). But when I use your example in the shell mode it works

Inner join with left join

2006-02-21 Thread Scott Haneda
Got myself a little stumped here, 4.0.18-standard Three tables in this mess, orders, order_items and products. orders.prod_id = order_items.prod_id = products.prod_id is how I relate them all to each other. order_items has a quantity field. I need a report that shows me all the products with