0

I have a web application where I am querying an InterSystems Cachè database. The query is:

SELECT TOP 10 "x_med_orders"."bnf_chapter","x_active_inpatients"."ward","x_active_inpatients"."lnkpid", "x_med_orders"."drug_description", "x_med_orders"."start_date", "x_med_orders"."discontinue_date", "x_med_orders"."stop_date" FROM  ( "XXX_Super"."x_active_inpatients" "x_active_inpatients" INNER JOIN "XXX_Super"."x_med_orders" "x_med_orders" ON "x_active_inpatients"."lnkpid"="x_med_orders"."lnkpid")WHERE = "x_med_orders"."bnf_chapter" = 'xxx'

When I remove the where clause, the query runs perfectly fine. If I however include it I get the error below. This is my first time dealing with this database type.

error image

2 Answers2

0

missing space after ) before where

  SELECT TOP 10 "x_med_orders"."bnf_chapter"
        ,"x_active_inpatients"."ward"
        ,"x_active_inpatients"."lnkpid"
        , "x_med_orders"."drug_description"
        , "x_med_orders"."start_date"
        , "x_med_orders"."discontinue_date"
        , "x_med_orders"."stop_date" 
  FROM   "XXX_Super"."x_active_inpatients" "x_active_inpatients" 
  INNER JOIN "XXX_Super"."x_med_orders" "x_med_orders" ON "x_active_inpatients"."lnkpid"="x_med_orders"."lnkpid"
  WHERE = "x_med_orders"."bnf_chapter" = 'xxx

and () in wrong place that mask the inner join

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
0

So in case this helps anyone else, the issue turns out I have to use the %EXACT function in my where clause:

WHERE ("x_med_orders"."bnf_chapter") = 'xxx'