db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin van den Bemt <mll...@mvdb.net>
Subject Re: Joins in torque (slightly Off Topic)
Date Fri, 20 Jan 2006 12:29:24 GMT
The standard mysql query browser has the option Query/explain, which gives an analyses of what
the 
query does.

Mvgr,
Martin

Alvaro Coronel wrote:
> Can you recommend a tool like MS Query Analyzer for MySQL
>   
>   Thx!
>   
>   Álvaro
> 
> Greg Monroe <Greg.Monroe@DukeCE.com> wrote:  An alternate thought is to just create
a view in the
> database (MySQL V5 supports them) and then do a 
> psuedo table in the XML to generate the required
> classes.
> 
> You probably already know this, but when you're 
> doing complex joins like this, pay close attention
> to what needs to be indexed.  Without the right
> indices, a large join query against a large number
> of records can grind your app to a halt. I tend to 
> spend some time in a Query Analyzer type tool 
> (e.g. MS SQL's Query Analyzer...lol) to optimize 
> any complex queries that underlie views.
> 
> 
>>-----Original Message-----
>>From: Stephan Spiegel [mailto:spiegel@szwo.de] 
>>Sent: Thursday, January 19, 2006 11:17 AM
>>To: torque-user@db.apache.org
>>Subject: Joins in torque
>>
>>
>>Hi, (in case this message is double please excuse me)
>>
>>I really do not understand what to do, I do not get the 
>>expected results!
>>
>>Let´s say I have 3 Tables: T1, T2 and T1_2
>>T1:
>>ID (integer pk)
>>value (varchar)
>>...
>>
>>T2:
>>ID (integer pk)
>>value (varchar)
>>...
>>
>>T1_2:
>>T1_ID (integer fk->T1)
>>T2_ID (integer fk->T2)
>>
>>As a result, I would like to have a union table showing the 
>>values of T1 and T2 in SQL this would be: select T1.value, 
>>T2.value from T1, T2, T1_2 where T1.ID = T1_2.T1_ID and T2.ID 
>>= T1_2.T2_ID
>>
>>if I get more than this (select * ...) would be fine as well.
>>
>>So, I have my classes but when I try to use them as written 
>>in Peers HowTo
>>(doSelectJoin...) or in Criteria HowTo (crit.addJoin(...)) I 
>>always get only the values of the T1_2-table
>>
>>As a first step, I try just to get the first half (result 
>>should show: T1.value, T1_2.T2_ID) so it should correspond to:
>>doSelectJoinT1(crit) in T1_2Peer
>>or:
>>crit.addJoin(T1.ID,T1_2.T1_ID,Criteria.LEFT_JOIN)
>>
>>as a result I just get the T1_2 values. I checked the 
>>mailing-list-archives, I can´t find a helpful message. Where 
>>is my mistake? Could somebody tell me exactly how to add this join?
>>
>>(I´m using torque-3.2, MySQL 5, defaultidMethod=native)
>>
>>thanks in advance, Stephan
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: torque-user-help@db.apache.org
>>
>>
> 
> 
> Duke CE Privacy Statement
> Please  be advised that this e-mail and any files transmitted with it are  confidential
communication or may otherwise be privileged or  confidential and are intended solely for
the individual or entity to  whom they are addressed. If you are not the intended recipient
you may  not rely on the contents of this email or any attachments, and we ask  that you please
not read, copy or retransmit this communication, but  reply to the sender and destroy the
email, its contents, and all copies  thereof immediately. Any unauthorized dissemination,
distribution or  copying of this communication is strictly prohibited.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 
> 
> 
> 		
> ---------------------------------
>  Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and
used cars.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message