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

Home » Community » U++ community news and announcements » Sql: *JoinRef
Sql: *JoinRef [message #34744] Fri, 09 December 2011 14:14 Go to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
It took some time and effort, but SqlExp is now able to create join conditions based on .sch file REFERENCES and PRIMARY_KEY attributes:

Select(ID(ID, NAME, LASTNAME))
.From(TABLE1).LeftJoinRef(TABLE2)
.Where(BDATE == Date(2011, 12, 9))


produces

select ID.ID, ID.NAME, ID.LASTNAME
 from TABLE1 left outer join TABLE2 on TABLE2.TABLE1_ID = TABLE1.NAME
 where BDATE = date '2011-12-09'


it is also possible to use On clause anyway - it gets combined with 'and':

Select(ID(ID, NAME, LASTNAME))
.From(TABLE1).LeftJoinRef(TABLE2).On(IsNull(BDATE))
.Where(BDATE == Date(2011, 12, 9))


select ID.ID, ID.NAME, ID.LASTNAME
 from TABLE1 left outer join TABLE2 on TABLE2.TABLE1_ID = TABLE1.NAME and BDATE is NULL
 where BDATE = date '2011-12-09'

 
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: Wed May 06 19:27:20 GMT+2 2026

Total time taken to generate the page: 0.00733 seconds