AnsweredAssumed Answered

SQL Syntax question

Question asked by wmyers on Oct 11, 2018
Latest reply on Oct 11, 2018 by wmyers

I'm trying to teach myself SQL and I'm stuck on what should be simple.

I'm trying to compose a simple SQL query using "safe sql":

I can't figure out the proper syntax for the WHERE:  I just want to search the field based on conditon <> "Closed"

Thanks!!

 

 

Let(

[

delim = "|" ;

 

theFields = GTFN (Shipments::Primary Sales) & ", " &

            "SUM (" & GTFN ( Shipments::c_Ship Quarter) & " )" ;

 

theTable = GTN (Shipments::ID_Shipped Line Items) ;

 

theWhere = GTFN ( Shipments::RMA Status ) &  <> " Closed "  ;

 

groupby =  GTFN (Shipments::Primary Sales) ;

 

theSQL =

 

"SELECT " & thefields &¶&

"FROM " & theTable &¶&

"WHERE" & theWhere &¶&

"GROUP BY " & groupby

 

] ;

 

ExecuteSQL( theSQL ; delim ; "" )

)

Outcomes