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

Complex Query

2011-05-18 Thread 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 have: it works OK, except that it returns more than one row for books that have more than one author. select conca

Complex Query

2010-04-15 Thread Mimi Cafe
I have three tables from which I need to query for a keyword. The 3 tables are products, productsubcategories and productcategories. Fron these three tables, I need to query for a product name or keywork starting with the products table. if the keyword is not found in the product name or product_de

Re: Problem with a complex query

2007-08-16 Thread Baron Schwartz
Hello, "I don't know how indexes work" is something I hear often. I will try to answer in the form of a blog post when I have some time. It is too complex to really answer in a short form, but basically an index is a b-tree (look at wikipedia for a good explanation) built on top of the tabl

Re: Problem with a complex query

2007-08-15 Thread Hugo Ferreira da Silva
Hi, I've done some indexes in my tables and I solved my problem. But I still confused with indexes. I created one multiple index with the main 4 columns for mensagenspara's table. But it doesn't work. So, I created one index with 3 columns and one for each column, wich give me 4 indexes, and later

Re: Problem with a complex query

2007-08-15 Thread Michael Dykman
-- > From: Hugo Ferreira da Silva [mailto:[EMAIL PROTECTED] > Sent: 15 August 2007 13:35 > To: mysql@lists.mysql.com > Subject: Re: Problem with a complex query > > > I found something weird. > This is my query now > -- > (SELECT > m.codmensagem

RE: Problem with a complex query

2007-08-15 Thread Rhys Campbell
: mysql@lists.mysql.com Subject: Re: Problem with a complex query I found something weird. This is my query now -- (SELECT m.codmensagem, m.codprioridade, m.codusuario, m.codmensagemoriginal, m.codmensagempai, m.assunto, m.dataenvio, m.horaenvio, m.datalimite, m.horalimite

Re: Problem with a complex query

2007-08-15 Thread Hugo Ferreira da Silva
I found something weird. This is my query now -- (SELECT m.codmensagem, m.codprioridade, m.codusuario, m.codmensagemoriginal, m.codmensagempai, m.assunto, m.dataenvio, m.horaenvio, m.datalimite, m.horalimite, m.anexo, m.tipo, u.nome, up.nome as nomepara, mp.codrespondida, mp

RE: Problem with a complex query

2007-08-15 Thread Rhys Campbell
r you. -Original Message- From: Hugo Ferreira da Silva [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] Sent: 14 August 2007 19:19 To: mysql@lists.mysql.com Subject: Re: Problem with a complex query I've created an index with the statement create index `usuario_pasta_situaca

Re: Problem with a complex query

2007-08-14 Thread Michael Dykman
> > MySQL doesn't seem to be very smart about queries involving OR and > > things like <>. For me creating temporary tables or writing perl > > scripts to do the job solved my particular problems. But I am working > > with tables that don't change but have some 100,000,000 rows... > > > > I guess I

Re: Problem with a complex query

2007-08-14 Thread Bernd Jagla
From explain you can see that your problem lies within the mensagens table (the first entry from your explain query) where it says type: ALL and rows 68337. This basically means that it is not using any index for this table. MySQL doesn't seem to be very smart about queries involving OR and

Re: Problem with a complex query

2007-08-14 Thread Hugo Ferreira da Silva
I've created an index with the statement create index `usuario_pasta_situacao` on `mensagens` (codusuario, codpasta, situacao); And for mensagenspara table this index create index `mensagem_usuario_pasta_situacao_idx` on `mensagenspara` (codmensagem, codusuario, codpasta, situacao); This is quer

Fwd: Problem with a complex query

2007-08-14 Thread Michael Dykman
The indexes are the primary way of tuning your query speed but bear in mind that mysql can only use 1 index-per-table-per-query.. your single column indexes do help some. try an EXPLAIN to see what I mean: EXPLAIN SELECT ... This will show you how mysql is approaching the query. From your qu

Re: Problem with a complex query

2007-08-14 Thread Bernd Jagla
what does explain tell you about the query? I also think you should try a combined index with all three columns that are used in one index. As far as I know only one index can be used per query... B On Aug 14, 2007, at 1:26 PM, Hugo Ferreira da Silva wrote: hum... I get it. But in my que

Re: Problem with a complex query

2007-08-14 Thread Hugo Ferreira da Silva
hum... I get it. But in my query, I look in 3 tables FROM mensagens m, mensagenspara mp, usuarios u, usuarios up WHERE m.codmensagem = mp.codmensagem AND u.codusaurio = m.codusuario AND up.codusuario = mp.codusuario m.codmensagem, u.codusaurio and up.codusuario are primary keys mp.codusuario,

Re: Problem with a complex query

2007-08-14 Thread Hugo Ferreira da Silva
diately by telephone or email and destroy the original > message without making a copy. Thank you. > > - Original Message - > From: "Hugo Ferreira da Silva" <[EMAIL PROTECTED]> > To: > Sent: Tuesday, August 14, 2007 11:04 AM > Subject: Problem with a c

RE: Problem with a complex query

2007-08-14 Thread Rhys Campbell
PROTECTED] Sent: 14 August 2007 16:04 To: mysql@lists.mysql.com Subject: Problem with a complex query Hi, I have a message system wich work in this way: - Each message can be sent to one or more recipients - Each message received have a lot of settings, like date and hour received, date and hour

Problem with a complex query

2007-08-14 Thread Hugo Ferreira da Silva
Hi, I have a message system wich work in this way: - Each message can be sent to one or more recipients - Each message received have a lot of settings, like date and hour received, date and hour of read, mark as read and so on - When the user select "view message", the system will get the history

Re: Complex query

2007-08-02 Thread Benjamin Ventura
son_id and B.product_type = "Product B" ; Give it a try !!! - Original Message - From: "Benjamin Ventura" <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Sent: Thursday, August 2, 2007 1:22:00 PM (GMT-0500) America/New_York Subject: Complex query I have a databas

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
m: "Benjamin Ventura" <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Sent: Thursday, August 2, 2007 1:22:00 PM (GMT-0500) America/New_York Subject: Complex query I have a database tracking registrations of software products with two related tables, "registered_products"

Complex query

2007-08-02 Thread Benjamin Ventura
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 combinations of products from the registered_produc

Re: counting on a complex query

2007-08-01 Thread Perrin Harkins
On 8/1/07, Les Fletcher <[EMAIL PROTECTED]> wrote: > SQL_CALC_FOUND_ROWS isn't an option for us. Right now I am doing two > queries, but I am just trying to see if there is a better way to do the > count query than to just turn it into a dervied table and count the > results i.e. SELECT COUNT(*) F

Re: counting on a complex query

2007-08-01 Thread Les Fletcher
SQL_CALC_FOUND_ROWS isn't an option for us. Right now I am doing two queries, but I am just trying to see if there is a better way to do the count query than to just turn it into a dervied table and count the results i.e. SELECT COUNT(*) FROM (big nasty query) t1. I think what the question is

Re: counting on a complex query

2007-08-01 Thread Perrin Harkins
On 8/1/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote: > Will SELECT SQL_CALC_FOUND_ROWS and SELECT FOUND_ROWS() do what you want? Be careful. While it will give the correct number of rows that would have been found if LIMIT had not been used, it makes the server compute the whole result set, disab

RE: counting on a complex query

2007-08-01 Thread Jerry Schwartz
> -Original Message- > From: Les Fletcher [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 01, 2007 3:27 PM > To: mysql@lists.mysql.com > Subject: counting on a complex query > > I have a nice little query that I can get the results from > fine, but am > having problems f

counting on a complex query

2007-08-01 Thread Les Fletcher
I have a nice little query that I can get the results from fine, but am having problems figuring out the best way to get the count directly from mysql. The query looks like the following: SELECT t1.id, t1.col1, t2.id, t2.col1, t2.col2, t2.col3, t2.col4 FROM t1 JOIN t2 ON ( t2.id = t1.col1 ) W

Re: Mysql Complex Query to clear Duplicate entries...

2006-09-25 Thread Shen139
es for example) so i can't group them Any ideas? -- View this message in context: http://www.nabble.com/Mysql-Complex-Query-to-clear-Duplicate-entries...-tf2331150.html#a6485034 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list arc

Mysql Complex Query to clear Duplicate entries...

2006-09-25 Thread gerodim
important) and delete all BUT ONE! I have no clue as to how i can delete all but one... Also the rest of the data may differ a little bit (datetimes for example) so i can't group them Any ideas? -- View this message in context: http://www.nabble.com/Mysql-Complex-Query-to-clear-Duplicate-en

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

Complex Query

2006-03-14 Thread ElkinFernando Ortiz
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 correspondientes desde la hora 11 hasta la 24 con los consumos en cero. Siempre un conjunto d

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
en") FROM shipments s JOIN returns r ON s.id = r.id GROUP BY s.dateshipped ORDER BY s.dateshipped DESC ; Does this do anything worthwhile? "James M. Gonzalez" <[EMAIL PROTECTED]> 12/08/2005 16:16 To cc Subject Complex query. (It's killing me) Hello list,

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

Complex query. (It's killing me)

2005-08-12 Thread James M. Gonzalez
Hello list, I got a sql query that's is just beating me (5-0). Have have read here and there, and MySQL Query Browser is just fed up with all the tries I have made it do. It is just not working. First, the tables (simplified version, if need more info just tell me): [shipments] ID int DateShippe

Re: Help needed with complex Query

2005-06-06 Thread Philip Lawatsch
[EMAIL PROTECTED] wrote: >>I pretty much have no idea how I can do this without nested queries (and >>to be frank not even how to do it with them) so I'd really appreciate >>any help! > > >>kind regards Philip > > > Try this as a starting point: > I think you were having two mental problems

Re: Help needed with complex Query

2005-06-06 Thread Brent Baisley
Unless you are keeping track of whether a widget in complete or not, there is no hope but to scan the entire table to determine if a widget is complete. That's something you don't want to do. You should mark a widget as complete when it is completed. This would mean checking if a particular wid

Re: Help needed with complex Query

2005-06-06 Thread gerald_clark
Philip Lawatsch wrote: Hi, I'm trying hard to figure out how to perform a special query in mysql 4.0. I have one table "widgets" which has a column "widget-id" (int) and one column "number_of_parts" (int). And then I have another table "part_mapping" which has one column "widget-id" (int) and

Re: Help needed with complex Query

2005-06-06 Thread SGreen
Philip Lawatsch <[EMAIL PROTECTED]> wrote on 06/06/2005 01:37:37 PM: > Hi, > I'm trying hard to figure out how to perform a special query in mysql 4.0. > I have one table "widgets" which has a column "widget-id" (int) and one > column "number_of_parts" (int). > And then I have another table "p

Help needed with complex Query

2005-06-06 Thread Philip Lawatsch
Hi, I'm trying hard to figure out how to perform a special query in mysql 4.0. I have one table "widgets" which has a column "widget-id" (int) and one column "number_of_parts" (int). And then I have another table "part_mapping" which has one column "widget-id" (int) and one column "part_id" (int

Complex Query

2005-05-28 Thread Mike Blezien
Hello, I have a search query to build on two table below is the table structure, and I need to build a query to search on specific cities(or all cities),specific subjects(or all subjects) and specific levels(or all levels) # Table structure for tt_jobs and tt_jobbids # tt_jobs pid int(6)

Complex Query: Best way to write it?

2004-11-09 Thread Keith Bussey
Hi, I am trying to come up with the most optimal way to write a query to select out the following fields: test_username.username_name test_subprofile_details.subprofile_details_headline test_profile.profile_birthday test_profile_gender.profile_gender_name test_subprofile.subprofile_picture test_c

help with complex query please (corrected)

2004-07-27 Thread Greg Sloman
Using MySQL: 3.23.46 (Correction) The select query below returns a grouped list of all featured artists. Their images are listed in a random order within each artist group. Is it possible to still return *all* featured artists (there are 6) but only a random selection of no greater than 2 ima

help with complex query please

2004-07-27 Thread Greg Sloman
Using MySQL: 4.23.46 The select query below returns a grouped list of all featured artists. Their images are listed in a random order within each artist group. Is it possible to still return *all* featured artists (there are 6) but only a random selection of no greater than 2 images from each

Re: To Re-write complex query with JOINS

2004-01-19 Thread Aman [System Support]
hi vijay, You can use order by & group by commands in the queries.. Thanks and Regs, - Aman. On Mon, 19 Jan 2004, Vijay Patel wrote: > Hello friends, > > I have a problem with one of the JOIN query here. > Below is a brief description of the problem. > > tablename : test > > RecordId Ef

To Re-write complex query with JOINS

2004-01-19 Thread Vijay Patel
Hello friends, I have a problem with one of the JOIN query here. Below is a brief description of the problem. tablename : test RecordId EffectiveDate othertableidvalue - - 1 2004-01-10 1 10 2

Re: Trouble With Counting New Documents With Complex Query

2004-01-04 Thread Adam i Agnieszka Gasiorowski FNORD
Bob Terrell wrote: > So there you go. Give it a shot and see if it runs any faster. If you need the time, > replace that first test in the WHERE clause with the one mentioned above. If this is > run often (or if it just takes a _really_ long time), put an index on the date > field, if one isn'

Re: Trouble With Counting New Documents With Complex Query

2004-01-04 Thread Adam i Agnieszka Gasiorowski FNORD
Bob Terrell wrote: > on 1/2/04 12:59 PM, Adam i Agnieszka Gasiorowski FNORD wrote: > > Thanks for the info. Just so I'm sure I know what I should: :) Thanks for your answer, very helpful! > > > $suma = 0; > > For starters, you won't need this line anymore. You'll see why in a minute

Re: Trouble With Counting New Documents With Complex Query

2004-01-03 Thread Bob Terrell
on 1/2/04 12:59 PM, Adam i Agnieszka Gasiorowski FNORD wrote: Thanks for the info. Just so I'm sure I know what I should: :) 1) You only want the day's articles. These are records in the article table and nowhere else. 2) An article will always belong to at least one section, and may belong to m

Re: Trouble With Counting New Documents With Complex Query

2004-01-03 Thread Adam i Agnieszka Gasiorowski FNORD
Bob Terrell wrote: > on 1/2/04 12:59 PM, Adam i Agnieszka Gasiorowski FNORD wrote: > > > Tell me if you need any additional information. > > Thank you for all your help. > > Some additional information would help, yes. What exactly are the sections, for > example? Do you need to know the numbe

Re: Trouble With Counting New Documents With Complex Query

2004-01-02 Thread Bob Terrell
on 1/2/04 12:59 PM, Adam i Agnieszka Gasiorowski FNORD wrote: > Tell me if you need any additional information. > Thank you for all your help. Some additional information would help, yes. What exactly are the sections, for example? Do you need to know the number of new _articles_ total, the new

Re: Trouble With Counting New Documents With Complex Query

2004-01-02 Thread robert_rowe
One other thing to check is that there are indexes on the fields in the other tables that you are joining to. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: [PHP-DB] Trouble With Counting New Documents With Complex Query

2004-01-02 Thread Alan Langford
In all probability it's "(x_section.Status & 1) = 0" and "(x_instance.Status & 255) = 0" that's giving you the problem. Unfortunately this is a database schema problem not a query fix. By putting a computation on a field into the WHERE clause, you're forcing the database to do that computation

Trouble With Counting New Documents With Complex Query

2004-01-02 Thread Adam i Agnieszka Gasiorowski FNORD
I need help width formulating the most effective (in terms of processing time) SQL query to count all the "new" documents in the repository, where "new" is defined as "from 00:00:01 up to 23:59:59 today". My current query does not give me satisfactory results, it creates a v

Re: Some help with a complex query

2003-11-17 Thread Roger Baklund
* Elisenda [...] > So, the good way to write joins will be as follows, doesn't it? > > FASE.SQL_ID_CE=CA.CA_ID_CE AND > FASE.PR_PP_ID_COORD=PP.PP_ID_PP AND > CA.CA_ID_CE=CE.CE_ID_CE AND > FASE.AU_PR_AULA=AU.AU_AULA Those are the exact same criteria as you had, only in a different order, isn't it?

Re: Some help with a complex query

2003-11-15 Thread Elisenda
Roger, > * Elisenda > [...] >> The explain select says as follows: > [...] > > I re-formatted the query and the EXPLAIN output for readability: Sorry for not re-formatted the query, I've learn it for next time. Well, I've learn a lot with your lessons. > > Select FASE.PR_Date_Visita_2, CE.CE_

Re: Some help with a complex query

2003-11-14 Thread Roger Baklund
* Elisenda [...] > The explain select says as follows: [...] I re-formatted the query and the EXPLAIN output for readability: Select FASE.PR_Date_Visita_2, CE.CE_Centro, CE.CE_Domicilio, CE.CE_CP, CE.CE_Poblacion, CE.CE_Capital, CE.CE_PROV, CE.CE_CCAA, CA.CA_Horario, PP.PP_Contacto, PP.PP_C

Re: Some help with a complex query

2003-11-14 Thread Elisenda
Roger, Your help was fantastic. It seems that it goes better. At the end I achieve some result but not all I need. The explain select says as follows: EXPLAIN Select FASE.PR_Date_Visita_2, CE.CE_Centro, CE.CE_Domicilio, CE.CE_CP, CE.CE_Poblacion, CE.CE_Capital, CE.CE_PROV, CE.CE_CCAA,CA.CA_Hora

Re: Some help with a complex query

2003-11-12 Thread Roger Baklund
* Elisenda > The problem is that it 's too slow and the result doesn't appear. > I am going to try to explain the query. Please do that using the EXPLAIN SELECT statement: http://www.mysql.com/doc/en/EXPLAIN.html > This will show what index is beeing used on the different joins, and approximatel

Re: Some help with a complex query

2003-11-12 Thread Elisenda
I'm sorry I didn't explain anything. The problem is that it 's too slow and the result doesn't appear. I am going to try to explain the query. Fields from Table FASE: (300.000 records) ID INT AUTO_INCREMENT NOT NULL PRIMARY KEY, SQL_ID_PY char(6), SQL_ID_CE char(6), PR_flag INT, PR_Date_Visita

Re: Some help with a complex query

2003-11-11 Thread Leo
it would help alot if you dump the table structure for us - Original Message - From: Elisenda To: [EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 7:10 PM Subject: Some help with a complex query I have a query which tries to select different fields from 5 different

Re: Some help with a complex query

2003-11-11 Thread Roger Baklund
* Elisenda > I have a query which tries to select different fields from 5 different > tables. > > In WHERE part I have write all the conditions and relationships. > Perhaps two many. Joining 5 tables should not be a problem, but having indexes on the relevant columns may be essential, especial

Some help with a complex query

2003-11-11 Thread Elisenda
I have a query which tries to select different fields from 5 different tables. In WHERE part I have write all the conditions and relationships. Perhaps two many. The main table for me is FASE. From this table I try to find all the other information. I guess I'm doing something wrong but I d

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
hopefully it work :) -leo- - Original Message - From: Steffan A. Cline To: [EMAIL PROTECTED] Sent: Monday, November 10, 2003 12:56 PM Subject: Complex query woes Basically I have a table that contains 3 types of records. Property managers, buildings and tenants. They are

Complex query woes

2003-11-09 Thread Steffan A. Cline
I am hoping someone here might have an idea how to set up a complex query I have been trying to figure out. Basically I have a table that contains 3 types of records. Property managers, buildings and tenants. They are related upon insert by an ID and a PID (parent id). For example : ID PID

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
PROTECTED] Subject: complex query qusetion Hi, I'm looking at some search engine where we can have up to 14-15 categories and each categories have about 5-10 option (checkbox) my question is if we have a complex query like this would it be better to split some categories in tables i.e we ha

complex query qusetion

2003-07-17 Thread awarsd
Hi, I'm looking at some search engine where we can have up to 14-15 categories and each categories have about 5-10 option (checkbox) my question is if we have a complex query like this would it be better to split some categories in tables i.e we have 21 different categories should we h

Possible SOLUTION SENDER?? Complex query, grouping and counting challenge

2003-01-09 Thread nospam1001
Believe that a respondent sent an email which appears to have been bounced & deleted before I got a chance to view it. If you are the person, please resend your response! Thank you. === Very complex Grouping and counting challenge Can anyone offer guid

Complex query, grouping and counting challenge

2003-01-07 Thread hturnbull
Very complex Grouping and counting challenge Can anyone offer guidance and suggest SQL which will assist in resolving this complex and challenging (for me) issue? I hope that my attempt to clearly state this problem is successful. The Environment: Queries and presentation using PHP Version 4.0.

re: The query analizer locks with a complex query using inner left

2002-12-04 Thread Egor Egorov
cked up running a complex query, We have been surprised to ml> find that using EXPLAIN could hang it as well, even with freshly rebuilt ml> and analyzed indexes. If there is no data, EXPLAIN fails saying "Impossible ml> WHERE notices after reading const tables", as there is nothi

The query analizer locks with a complex query using inner left

2002-12-01 Thread martin langhoff
joins and nested where clauses. >Description: The query analyzer seems to hang while trying to parse/optimize this particular query if there is data in the table. Trying to understand why mysql locked up running a complex query, We have been surprised to find that using EXPLAIN could h

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
]> Subject: Complex Query > Hi, > I need help with a complex query that I can't figure it out myself. > > Suppose that I have the following tables > > 1) stations > -id > -name > 2) invitations > -id > -station_id &

Complex Query

2002-11-29 Thread Ahmed Farouk
Hi, I need help with a complex query that I can't figure it out myself. Suppose that I have the following tables 1) stations -id -name 2) invitations -id -station_id -invitation_status (confirmed, cancelled, postponed) I need a query that gener

question on optimizing complex query

2002-11-25 Thread Steve Yates
Hello, I am relatively new to MySQL though I have database experience. I have a query that doesn't seem to want to use an index for the first table despite my indexing several fields. Before I get too far in the details of the query, here is what EXPLAIN SELECT tells me for the first tab

RE: Need help with a complex query

2002-06-18 Thread Peter Normann
= 0; Jeez either I should be getting some coffee or some sleep Peter Normann -Original Message- From: Jamie Tibbetts [mailto:[EMAIL PROTECTED]] Sent: 18. juni 2002 22:21 To: Peter Normann; [EMAIL PROTECTED] Subject: Re: Need help with a complex query >>> Try - and I

Re: Need help with a complex query

2002-06-18 Thread Jamie Tibbetts
>>> Try - and I mean *try* :-) >>> >>> SELECT Customers.* FROM Customers, Subscriptions >>> LEFT JOIN Orders ON (Orders.customerid=Customer.CustomerID) >>> LEFT JOIN Ordered_Items ON (Ordered_Items.orderid=Orders.id && >>> (Ordered_Items.productid = '23')) >>> WHERE Customers.id=Subscriptions.cus

RE: Need help with a complex query

2002-06-16 Thread Peter Normann
18 To: Peter Normann; [EMAIL PROTECTED] Subject: Re: Need help with a complex query > Try - and I mean *try* :-) > > SELECT Customers.* FROM Customers, Subscriptions > LEFT JOIN Orders ON (Orders.customerid=Customer.CustomerID) > LEFT JOIN Ordered_Items ON (Ordered_Ite

  1   2   >