U++ framework
Do not panic. Ask here before giving up.

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: 14291
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: Mon Jul 06 01:57:47 GMT+2 2026

Total time taken to generate the page: 0.00690 seconds