sql server – Azure SQL optimize IN query
I’m trying to optimize the IN query on Azure SQL. This IN query has more than 50k records. With the optimization, I will use the INNER join. This is what I was trying
SELECT incident_nbr from table_name as incidents INNER JOIN unnest(ARRAY['INC123456', 'INC0123456', 'INC432156']) as inc ON inc=incidents.incident_nbr;
But looks this syntax is incorrect. DBeaver shows this error in the SQL script editor.
org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error [102] [S0001]: Incorrect syntax near ')'.
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:577)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$1(SQLQueryJob.java:486)
Am I missing anything? TIA.
Read more here: Source link