Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » Sql: *JoinRef
Re: Sql: *JoinRef [message #34971 is a reply to message #34969] Thu, 22 December 2011 08:17 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Didier wrote on Wed, 21 December 2011 18:22

Hi,

What syntax can I use to serialize more than one join at a time.

Take the following stupid .sch example:

TABLE_(TABLE_B)
	INT_    (B_ID) PRIMARY_KEY AUTO_INCREMENT
	INT_    (AGE)
END_TABLE

TABLE_(TABLE_C)
	INT_    (C_ID) PRIMARY_KEY AUTO_INCREMENT
	INT_    (WEIGTH)
END_TABLE

TABLE_(TABLE_A)
	INT_    (A_ID) PRIMARY_KEY AUTO_INCREMENT
	INT_    (A_REF_B) REFERENCES(TABLE_B)
	INT_    (A_REF_C) REFERENCES(TABLE_C)
	INT_    (A_SIZE)
END_TABLE


I would like to write something like:

Sql * Select(myData).From(TABLE_A)
      .LeftJoinRef(TABLE_B).Where(AGE == xxxx)
      .LeftJoinRef(TABLE_C).Where(WEIGHT == yyyy)


Is this possible ??



This one no. The answer depends on what kind of SQL do you want to produce.

I think the most sense makes this:

Sql * Select(myData).From(TABLE_A)
      .LeftJoinRef(TABLE_B).On(AGE == xxxx)
      .LeftJoinRef(TABLE_C).On(WEIGHT == yyyy)


(but it is not 'where', because we have left joins, so AGE or WEIGHT would yield null, which would exclude such records when placed in where).

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Settings and multiple ide instances
Next Topic: DataSource
Goto Forum:
  


Current Time: Sat Jun 08 17:42:48 CEST 2024

Total time taken to generate the page: 0.01619 seconds