I am trying to get "unique types of crimes have been recorded at GAS STATION locations" from the table CHICAGO_CRIME_DATA on Juptyter Notebook.
%sql select DISTINCT PRIMARY_TYPE from CHICAGO_CRIME_DATA WHERE LOCATION_DESCRIPTION = 'GAS STATION';
PRIMARY_TYPE
and LOCATION_DESCRIPTION
are the column names.
I am operating in IBM DB2. It is producing an error.
ibm_db_sa://ddk87262:***@dashdb-txn-sbox-yp-lon02-01.services.eu-gb.bluemix.net:50000/BLUDB
(ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: SQLNumResultCols failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0134N Improper use of a string column, host variable, constant, or function "PRIMARY_TYPE". SQLSTATE=42907 SQLCODE=-134
[SQL: select DISTINCT PRIMARY_TYPE from CHICAGO_CRIME_DATA WHERE LOCATION_DESCRIPTION = 'GAS STATION';]
(Background on this error at: http://sqlalche.me/e/f405)
I have double-checked the column names . The code displays results (with redundant rows) if I dont use the Distinct function.
What would cause this error?