Re: Complex Query

2011-05-19 Thread Claudio Nanni
Hint: - group_concat - group by - having count(*)1 Cheers Claudio 2011/5/18 Mimi Cafe mimic...@googlemail.com Hi I am trying to retrieve record from 2 tables (book and author), but my problem is how to retrieve all the names of authors where more than one author wrote a book.

Interesting bug/oversight

2011-05-19 Thread Johan De Meersman
Just encountered an interesting issue. I use DNS names instead of IPs in mysql grants. Yes, I'm aware of the performance impact, that's not an issue. I just found out through failing logins that a server was still connecting to an old DNS server, and properly updated the resolv.conf.

Re: Interesting bug/oversight

2011-05-19 Thread Claudio Nanni
Johan, Consider also the DNS TTL. If you flush hosts in MySQL it'll ask again the OS to resolve a name , but if that is still in the DNS cache it could return that 'old' value instead of querying the newly updated NS. I'm not sure thou, may be test by restarting the name server cache deamon

RE: Complex Query

2011-05-19 Thread Mimi Cafe
The tables have following structure. Both keys in table book_author are not primary keys (should they?). Author book_author book publisher subject subject_book == ==

Re: Restore only one database or one table

2011-05-19 Thread Johan De Meersman
- Original Message - From: Suresh Kuna sureshkumar...@gmail.com Try to take a tab separated dump, so you can restore what ever you want in terms of tables or databases. Uhh. I'm a bit fuzzy today, but I really don't see how a tab-separated dump will help split off tables or

Re: Interesting bug/oversight

2011-05-19 Thread Johan De Meersman
- Original Message - From: Claudio Nanni claudio.na...@gmail.com Consider also the DNS TTL. That should be irrelevant when changing DNS servers :-) If you flush hosts in MySQL it'll ask again the OS to resolve a name , but if that is still in the DNS cache it could return that

Re: Restore only one database or one table

2011-05-19 Thread Adarsh Sharma
Johan De Meersman wrote: - Original Message - From: Suresh Kuna sureshkumar...@gmail.com Try to take a tab separated dump, so you can restore what ever you want in terms of tables or databases. Uhh. I'm a bit fuzzy today, but I really don't see how a tab-separated dump will

Re: Complex Query

2011-05-19 Thread Hal�sz S�ndor
2011/05/18 22:22 +0100, Mimi Cafe I am trying to retrieve record from 2 tables (book and author), but my problem is how to retrieve all the names of authors where more than one author wrote a book. Here is what i have: it works OK, except that it returns more than one row for books that have

Triggers for Table Duplication

2011-05-19 Thread Steve Staples
Ok, say i have this table: CREATE TABLE `User` ( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, `email` VARCHAR(50) DEFAULT NULL, `pass` VARCHAR(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MYISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 and i

Re: Interesting bug/oversight

2011-05-19 Thread Dan Nelson
In the last episode (May 19), Johan De Meersman said: I use DNS names instead of IPs in mysql grants. Yes, I'm aware of the performance impact, that's not an issue. I just found out through failing logins that a server was still connecting to an old DNS server, and properly updated the

Re: Restore only one database or one table

2011-05-19 Thread Eric Bergen
The mysql command line has the -o option to only execute queries for the default database. This can be used to restore one database from a dump file that contains many. For specific tables you can setup a restore user that only has permissions on the tables you want to restore then use the -f flag

Re: Restore only one database or one table

2011-05-19 Thread Prabhat Kumar
might be my blog will help you :) http://adminlinux.blogspot.com/2009/11/extract-single-dbtable-from-dump-file.html have a good time.. On Thu, May 19, 2011 at 7:42 AM, Eric Bergen eric.ber...@gmail.com wrote: The mysql command line has the -o option to only execute queries for the default

Re: Complex Query

2011-05-19 Thread Guido Schlenke
Hi Mimi, I'm not quite sure, if I did understand you right, but let's try the following query: select a.firstname, a.lastname, b.subject from Author a, book_author ba, book b where a.fkauthor_id IN ( select fkauthor_id, count(*) from book_author group by fkauthor_id having count(*) 1 ) and

Re: Interesting bug/oversight

2011-05-19 Thread Johan De Meersman
- Original Message - From: Dan Nelson dnel...@allantgroup.com I doubt that mysql calls anything other than gethostbyname() or getaddrinfo(), so your behaviour is probably dependant on whatever OS you are running and how often its local resolver re-checks resolv.conf. Usually that's

Re: Complex Query

2011-05-19 Thread Guido Schlenke
Hi Mimi, I'm sorry, but my query doesn't work. In between I created 3 tables: authors: +---+--+--+-+-+ | Field | Type | Null | Key | Default | Extra +---+--+--+-+-+ |

RE: Complex Query

2011-05-19 Thread Mimi Cafe
Hi Guido I like your powerful query below, but it doesn't answer my question. I guess some clarification is needed here. OK, I have books in the database with more than one author. When I query for the title of books and name of author, I get more rows for books that have more than one

Re: Restore only one database or one table

2011-05-19 Thread Hal�sz S�ndor
2011/05/19 12:43 +0200, Johan De Meersman Uhh. I'm a bit fuzzy today, but I really don't see how a tab-separated dump will help split off tables or databases :-) To answer the original question, though; the technically accurate answer is yes, you can. It's made easy because mysqldump