RE: Complex Query

2011-05-21 Thread Mimi Cafe
ido => Schlenke => Subject: Re: Complex Query => => >>>> 2011/05/21 00:22 +0200, Johan De Meersman >>>> => Heh. The parser is pointing out a simple syntax oversight, yes. The => correct syntax for that is select ... from (subselect) aliasname; => <<<

Re: Complex Query

2011-05-21 Thread Hal�sz S�ndor
2011/05/21 00:22 +0200, Johan De Meersman Heh. The parser is pointing out a simple syntax oversight, yes. The correct syntax for that is select ... from (subselect) aliasname; And that is required whether the alias is used or not. I at those times have been tripped up by this r

Re: Complex Query

2011-05-20 Thread Johan De Meersman
sql.com > Sent: Friday, 20 May, 2011 11:52:14 PM > Subject: RE: Complex Query > > 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. >

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 Que

RE: Complex Query

2011-05-20 Thread Mimi Cafe
duce expected result - especially after running a query with MySQL limit clause. Mimi => -Original Message- => From: Johan De Meersman [mailto:vegiv...@tuxera.be] => Sent: 20 May 2011 21:16 => To: Guido Schlenke => Cc: mysql@lists.mysql.com => Subject: Re: Complex Query =>

Re: Complex Query

2011-05-20 Thread Johan De Meersman
- Original Message - > From: "Guido Schlenke" > To: mysql@lists.mysql.com > Sent: Friday, 20 May, 2011 9:04:32 PM > Subject: Re: Complex Query > > Hi Mimi, > > try this > > select count(*) from > (SELECT module_nr, IFNULL(image,'no_image

Re: Complex Query

2011-05-20 Thread Guido Schlenke
googlemail.com] Sent: 20 May 2011 11:33 To: 'Anupam Karmarkar' Cc: 'Guido Schlenke'; mysql@lists.mysql.com Subject: RE: Complex Query 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"

RE: Complex Query

2011-05-20 Thread Mimi Cafe
or_id = pkauthor_id WHERE module_nr = ? group by IFNULL(image,'no_image.jpg'),title, subtitle, pkisbn, publisher; Mimi From: Mimi Cafe [mailto:mimic...@googlemail.com] Sent: 20 May 2011 11:33 To: 'Anupam Karmarkar' Cc: 'Guido Schlenke'; mysql@lists.mysql.co

RE: Complex Query

2011-05-20 Thread Mimi Cafe
May 2011 07:48 To: 'Guido Schlenke'; mysql@lists.mysql.com; Mimi Cafe Subject: RE: Complex Query Hi Guido, You need to add group by in your query get desire result SELECT IFNULL(image,'no_image.jpg') as image,title, subtitle, group_concat(concat(fname,' ',initial,&

RE: Complex Query

2011-05-19 Thread Anupam Karmarkar
age,title, subtitle, pkisbn, publisher It should give desire result. As group concat will return group by 1 if you dont specify group by, which will return only one row, to get result you need to specify group by as given in above query. --Anupam --- On Fri, 20/5/11, Mimi Cafe wrote: From:

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 author.

Re: Complex Query

2011-05-19 Thread Guido Schlenke
ut error, but no relation can be seen when the module is created in mysql workbench. Thanks Mimi => -Original Message- => From: George Pitcher [mailto:george.pitc...@publishingtechnology.com] => Sent: 19 May 2011 06:42 => To: Mimi Cafe => Subject: RE: Complex Quer

Re: Complex Query

2011-05-19 Thread Guido Schlenke
=> -Original Message- => From: George Pitcher [mailto:george.pitc...@publishingtechnology.com] => Sent: 19 May 2011 06:42 => To: Mimi Cafe => Subject: RE: Complex Query => => Mimi, => => I have a lot of biblio records across several applications. I decided => a

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

RE: Complex Query

2011-05-19 Thread Mimi Cafe
mysql workbench. Thanks Mimi => -Original Message- => From: George Pitcher [mailto:george.pitc...@publishingtechnology.com] => Sent: 19 May 2011 06:42 => To: Mimi Cafe => Subject: RE: Complex Query => => Mimi, => => I have a lot of biblio records across se

Re: Complex Query

2011-05-19 Thread Claudio Nanni
Hint: - group_concat - group by - having count(*)>1 Cheers Claudio 2011/5/18 Mimi Cafe > 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. > > Here is what i

Re: Complex query

2007-08-02 Thread Benjamin Ventura
Brilliant, this one works perfect! Thank you for the quick reply! Ben Rolando Edwards wrote: select distinct email_address from people P,registered_products A,registered_products B where P.person_id = A.person_id and A.product_type = "Product A" and P.person_id = B.person_id and B.prod

Re: Complex query

2007-08-02 Thread Baron Schwartz
Hi Benjamin, Benjamin Ventura wrote: I have a database tracking registrations of software products with two related tables, "registered_products" and "people". I need to pull a list of email addresses from the people table BUT I only want to pull people records who own very specific combinati

Re: Complex query

2007-08-02 Thread Rolando Edwards
select distinct email_address from people P,registered_products A,registered_products B where P.person_id = A.person_id and A.product_type = "Product A" and P.person_id = B.person_id and B.product_type = "Product B" ; Give it a try !!! - Original Message - From: "Benjamin Ventura"

Re: Complex Query

2006-03-14 Thread Peter Brawley
ElkinFernando Ortiz wrote: How i calculate for union the other 14 register in the same Query? ... SELECT e.Plant,e.Date,e.Hour,e.Consuption From Energy Where e.Plant=Var_Plant AND e.Date=Var_Date GROUP BY e.Plant,e.Date,e.H By having an hours table (hour tinyint) which you join to your energy

Re: Complex Query

2006-03-14 Thread SGreen
"ElkinFernando Ortiz" <[EMAIL PROTECTED]> wrote on 03/10/2006 12:26:57 AM: > I will explain my problem in spanish and english. > > Se deben Presentar los consumos por 24 horas de energia para su ingreso. Si > el usuario ha digitado 10 registros, se deben presentar estos mas los otros > 14 corr

Re: Complex query. (It's killing me)

2005-08-12 Thread Scott Noyes
> mysql Ver 12.22 Distrib 4.0.20, for mandrake-linux-gnu (i586) With 4.1, it might have been a little easier using some subqueries. But with 4.0, I don't think we can get the results you're looking for in a single query, without some really nasty setup. Part of the issue is that we need to join

RE: Complex query. (It's killing me)

2005-08-12 Thread James M. Gonzalez
of conditions (like where clausules) James -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 12 August 2005 16:41 To: [EMAIL PROTECTED] Cc: James M. Gonzalez; mysql@lists.mysql.com Subject: Re: Complex query. (It's killing me) Sorry - I think you need a

Re: Complex query. (It's killing me)

2005-08-12 Thread James M. Gonzalez
-Original Message- From: James M. Gonzalez Sent: 12 August 2005 16:58 To: 'Scott Noyes' Subject: RE: Complex query. (It's killing me) Sorry, I will explain myself more clearly: Everyday, we ship packages, and we also receive some packages. The one we receive, has bee

Re: Complex query. (It's killing me)

2005-08-12 Thread Alec . Cawley
Sorry - I think you need a LEFT JOIN or it won't count shipments which are not returned. Alec [EMAIL PROTECTED] 12/08/2005 16:38 To [EMAIL PROTECTED] cc mysql@lists.mysql.com Subject Re: Complex query. (It's killing me) Just in the spirit of refining my own skills, her

Re: Complex query. (It's killing me)

2005-08-12 Thread Alec . Cawley
Just in the spirit of refining my own skills, here is how I would tackle the problem. It parses, but I haven't populated the tables so I don't know if it works: SELECT s.dateshipped, COUNT(r.type="undelivered"), COUNT(r.type = "customer"), COUNT(r.status="open") FROM shipments s JOIN returns r

Re: Complex query. (It's killing me)

2005-08-12 Thread Scott Noyes
> Shipped Undelivered Returned Open > 12/8/2005 143 3 3 Does this mean of the 14 shipped on 12/8/2005, 3 were returned at some later date, or does it mean that you shipped 14 on 12/8/2005, and on that same day 3 unrelated shipments came back, each of which co

Re: Complex query woes

2003-11-10 Thread Leo
index my_id (id); -leo- - Original Message - From: Steffan A. Cline To: Leo ; [EMAIL PROTECTED] Sent: Monday, November 10, 2003 8:12 PM Subject: Re: Complex query woes Leo, Thanks for the quick reply. There was a typo but I fixed it. Below is what I used after

Re: Complex query woes

2003-11-10 Thread Steffan A. Cline
To: "Steffan A. Cline" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: Re: Complex query woes > > have you try left join? > > select > mgr.company, > building.bldgname, > tenant.id > from > customers mgr > left join customers building on buildin

Re: Complex query woes

2003-11-09 Thread Leo
have you try left join? select mgr.company, building.bldgname, tenant.id from customers mgr left join customers building on building.pid=mgr.id left join costumers tenant on tenant.pid=building.id group by mgr.id, building.id, tenant.id order by mgr.company, building.bldgname, tenant.company hop

Re: complex query qusetion

2003-07-18 Thread awards
;awarsd" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, July 18, 2003 10:26 AM Subject: RE: complex query qusetion The optimal way for query speed would be to combine the most commonly used categories. Because when you search the query categories, you will find out that there is

RE: complex query qusetion

2003-07-18 Thread Rudy Metzger
The optimal way for query speed would be to combine the most commonly used categories. Because when you search the query categories, you will find out that there is a small set of combinations (say 10) which are used 90% of the time. Example: you have the categories A, B, C, D, E, F, G, H, I. Afte

Re: Complex Query

2002-11-30 Thread Ahmed Farouk
corresponding number of invitations and a breaddown of inviations to show total number of each invitation_status - Original Message - From: "Sammy Lau" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, November 30, 2002 6:01 AM Subject: Re: Complex Query >

Re: Complex Query

2002-11-29 Thread Sammy Lau
try this: select a.name, b.invitation_status, count(*) from stations a, invitations b where a.id = b.station_id group by a.name, b.invitation_status - Original Message - From: "Ahmed Farouk" <[EMAIL PROTECTED]> Date: Fri, 29 Nov 2002 22:50:34 +0200 To: <[EMAIL PROTECTED]> Subject: Complex Q

RE: Complex query with PHP/MySQL

2002-03-01 Thread Doug Thompson
You're producing a query of the form SELECT x,y,z FROM table WHERE cat ="a,b,c" AND subcat="d,e,f"; Try: IMPLODE("\" OR \"",$category) or maybe even IMPLODE('" OR "',$category) to remove all the escaping. Doug On Fri, 1 Mar 2002 16:14:17 -, John Lodge wrote: >This is the sort of thing

RE: Complex query with PHP/MySQL

2002-03-01 Thread John Lodge
This is the sort of thing I would do $tmpquery = "SELECT item_pic, cat, sub, item_name, username FROM item_name WHERE 1=1 AND"; if($category) { $filter1 = " cat =\""; $filter1 .= implode("\",\"",$category); $filter1 .= " \" "; $tmpquery .= $filter1; $tmpquery .= " AND "; } if($subcat) { $filter2

Re: Complex Query Question

2001-09-04 Thread Adams, Bill TQO
Carl Schrader wrote: > Field Special 1 has a related field with a Start Date and another field > for End date. > Field Special 2 has a related field with a Start Date and another field > for End date. > Field Special 3 has a related field with a Start Date and another field > for End date. > IMN

RE: Complex Query Problems

2001-02-27 Thread Quentin Bennett
Hi, So long as there is some way of joining your two tables, this shouldn't be a problem: SELECT name FROM mytable, myothertable WHERE (mytable.ID = myothertable.idlistcolumn); Regards Quentin -Original Message- From: John Coggeshall [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 28 Febr