kigmaker

[solved] Fairly simple SQL problem

Discussion created by kigmaker on Nov 26, 2017
Latest reply on Nov 26, 2017 by kigmaker

Hello,

 

I have commented out everything that isn't required to query all events between STARTDATE and ENDDATE.

--- How can I use global fields 'c_EVENTS_STARTDATE' and 'c_EVENTS_ENDDATE' in table 'c_GLOBALS'

in place of global fields currently used from table 'a_EVENTS'?

--- Also, how can I search on more than one user selected value for field 'a_idUser' in table 'a_EVENTS'?

 

Thank you, Greg

 

Let ( [

a_EVENTS = sql.table ( Events::EventID ) & " a" ;

 

//b_GLOBALS = sql.table ( GLOBALS::id ) & " b" ;

 

a_DateEnd = "a." & sql.field ( Events::DateEnd ) ;

a_Json = "a." & sql.field ( Events::Json ) ;

a_EVENTS_STARTDATE = "a." & sql.field ( Events::EVENTS_STARTDATE ) ;

a_EVENTS_ENDDATE = "a." & sql.field ( Events::EVENTS_ENDDATE ) ;

 

//a_idUser = "a." & sql.field ( Events::idUser ) ;

//a_Z__CONNECTOR = "a." & sql.field ( Events::Z__CONNECTOR ) ;

//b_EVENTS_STARTDATE = "b." & sql.field ( GLOBALS::EVENTS_STARTDATE ) ;

//b_EVENTS_ENDDATE = "b." & sql.field ( GLOBALS::EVENTS_ENDDATE ) ;

//b_Z__CONNECTOR = "b." & sql.field ( GLOBALS::Z__CONNECTOR ) ;

 

_q =

" SELECT " & a_Json &

" FROM " & a_EVENTS &

 

//" INNER JOIN " & b_GLOBALS & " ON " & a_Z__CONNECTOR & " = " & b_Z__CONNECTOR &

 

" WHERE " & a_DateEnd &

" BETWEEN " & a_EVENTS_STARTDATE &

" AND " & a_EVENTS_ENDDATE

] ;

ExecuteSQL ( _q ; "" ; "" )

)

Outcomes