Re: Complex Query

2011-05-20 Thread Johan De Meersman
Heh. The parser is pointing out a simple syntax oversight, yes. The correct syntax for that is select ... from (subselect) aliasname; - Original Message - > From: "Mimi Cafe" > To: "Johan De Meersman" , "Guido Schlenke" > > Cc: mysql@lists.mysql.com > Sent: Friday, 20 May, 2011 11:52:1

RE: Complex Query

2011-05-20 Thread Mimi Cafe
I meant it may produce unexpected result. Mimi => -Original Message- => From: Mimi Cafe [mailto:mimic...@googlemail.com] => Sent: 20 May 2011 22:52 => To: 'Johan De Meersman'; 'Guido Schlenke' => Cc: mysql@lists.mysql.com => Subject: RE: Complex Query => => Select count(*) from (select..

RE: Complex Query

2011-05-20 Thread Mimi Cafe
Select count(*) from (select) did not work. It says: "ERROR 1248 (42000): Every derived table must have its own alias" and I am not sure it really mean aliases. Although "select found_rows();" works, I am trying to avoid it as the documentation says it may produce expected result - espe

Re: Complex Query

2011-05-20 Thread Johan De Meersman
Hmm. Simply replacing the field list with count(*) should work, too. If you only need the count after having executed the select, I'm pretty sure there's something in the API that gives you that without a second query, although I'll be buggered if I can remember right now. - Original Messag

Re: Changing the default database location

2011-05-20 Thread Johan De Meersman
- Original Message - > From: "Reindl Harald" > > so put the wgole mysqld and its data on a server in the network > for this mysql was built and not for borking the dadadir somewhere > else Hmm. The way I interpret what he's saying, is that he wants multiple instances accessing the same

Re: Complex Query

2011-05-20 Thread Guido Schlenke
Hi Mimi, try this select count(*) from (SELECT module_nr, IFNULL(image,'no_image.jpg'),title, subtitle, group_concat(concat(fname,' ',initial,' ',lname)), pkisbn, publisher,publication_year, edition, cover_type, pages FROM book INNER JOIN publisher on pkpublisher_id = fkpublisher_id INNE

Re: Changing the default database location

2011-05-20 Thread Reindl Harald
so put the wgole mysqld and its data on a server in the network for this mysql was built and not for borking the dadadir somewhere else Am 20.05.2011 15:58, schrieb Firdosh Dhooka: > Thanks Johan. > > The reason to move database onto the network is that multiple user can > access it. Do you think

Re: Changing the default database location

2011-05-20 Thread Firdosh Dhooka
Thanks Johan. The reason to move database onto the network is that multiple user can access it. Do you think there is a better alternative? Firdosh On Fri, May 20, 2011 at 9:45 AM, Johan De Meersman wrote: > > > - Original Message - >> From: "Reindl Harald" >> >> first: please post log

Re: Changing the default database location

2011-05-20 Thread Johan De Meersman
- Original Message - > From: "Reindl Harald" > > first: please post log-outputs instead of "don't work" > > i guess: you changed only the path in my.cnf > have you oved th existing datadir to the new location? > if not the server will not start because it is missing > the database "mys

RE: Complex Query

2011-05-20 Thread Mimi Cafe
Hi I now need to determine the number of rows returned by this query below. Wrapping it within SELECT COUNT did not work as expected. SELECT module_nr, IFNULL(image,'no_image.jpg'),title, subtitle, group_concat(concat(fname,' ',initial,' ',lname)), pkisbn, publisher,publication_

Re: Changing the default database location

2011-05-20 Thread Reindl Harald
Am 20.05.2011 15:05, schrieb Firdosh Dhooka: > I wanted to install mysql community server and workbench on my machine. > So I downloaded and installed it and everything seems working fine. > > But now I wanted to change the location of datadir from local to my > network. So I stop the server fir

Changing the default database location

2011-05-20 Thread Firdosh Dhooka
I wanted to install mysql community server and workbench on my machine. So I downloaded and installed it and everything seems working fine. But now I wanted to change the location of datadir from local to my network. So I stop the server first using workbench and then change the datadir under Opti

RE: MySQL ignores foreign key constraints

2011-05-20 Thread Mimi Cafe
Aha, got the offender. Unlike all other ones, tables book_author was MyISAM instead of Innodb. Now everything works alter table book_author add foreign key (fkauthor_id) references author (pkauthor_id); Query OK, 12 rows affected (0.39 sec) Records: 12 Duplicates: 0 Warnings: 0 mys

Re: MySQL ignores foreign key constraints

2011-05-20 Thread Suresh Kuna
WHat are the table engine types ? On Fri, May 20, 2011 at 4:37 PM, Mimi Cafe wrote: > Hi > > An ideas why MySQL silently ignores any foreign key constraints I define > for > the following tables? > > > mysql> desc book; > > +--+---+--+-+---

Re: MySQL ignores foreign key constraints

2011-05-20 Thread Andrew Moore
Try show create table ... ; A On Fri, May 20, 2011 at 12:07 PM, Mimi Cafe wrote: > Hi > > An ideas why MySQL silently ignores any foreign key constraints I define > for > the following tables? > > > mysql> desc book; > > +--+---+--+-+

MySQL ignores foreign key constraints

2011-05-20 Thread Mimi Cafe
Hi An ideas why MySQL silently ignores any foreign key constraints I define for the following tables? mysql> desc book; +--+---+--+-+-+- --+ | Field| Type | Null | Key | Default | Extra | +

RE: Complex Query

2011-05-20 Thread Mimi Cafe
Hi guys That's cool! It looks like my query was good except that I miss the "group by". Now I only had to remove the "as image" from the grouping below and it works fine. Thanks guys Mimi From: Anupam Karmarkar [mailto:sb_akarmar...@yahoo.com] Sent: 20 May 2011 07:48 To: 'Guido Sc

Re: Help with a query

2011-05-20 Thread Aveek Misra
I eventually came up with a solution myself although the query is a bit different SELECT C.file, C.digest, (a.cnt_A + b.cnt_B) AS total_count, C.refcount FROM C, (SELECT file, digest, COUNT(file) AS cnt_A FROM A GROUP BY file, digest) as a, (SELECT file, digest, COUNT(file) AS cnt_B FROM B GROUP

Re: Help with a query

2011-05-20 Thread Anupam Karmarkar
Hi Aveek, You need to use something like union all and having to get desire result Follow example below select file, digest  from ( SELECT file, digest,Count(*)  as Cnt FROM A GROUP BY file, digest union all SELECT file, digest,Count(*)  as Cnt FROM B GROUP BY file, digest ) tmp group by file,