How to have different values of a single column in a condition where in sql?

434 Views Asked by At

I write a SQL query to get different sales information about stores.

The problem is that I would like to filter and take only some store numbers in my "GL_ETABLISSEMENT" column, if I just do AND (GL_ETABLISHMENT = "20897") it works but not if I add more behind, how can I do it?

SELECT 
    T_ETABLISSEMENT, ET1.ET_LIBELLE AS C1, GL_ETABLISSEMENT, 
    GP_HEURECREATION, GP_REFINTERNE, GL_CODEARTICLE, 
    LIBDIM2, LIBDIM1, GL_QTEFACT, GL_PUTTC, 
    (GL_TOTALHT * GP_COTATIONDOS) AS TOTALHTDEV, GL_DPR, GL_DEVISE, 
    GL_NATUREPIECEG, GA_LIBELLE 
FROM 
    GCLIGNEARTDIM  
LEFT OUTER JOIN 
    PGI_LOOKUP(TTETABLISSEMENT) ET1 ON GL_ETABLISSEMENT = ET1.ET_ETABLISSEMENT 
WHERE 
    (GP_HEURECREATION >= "20201130 00:00:00"
    AND (GL_NATUREPIECEG = "FFO") 
    AND GL_ETABLISSEMENT = "20897", "10519", "20267", "26451", "20269", "26078", "28047", "20900", "28085", "24984", "27113", "20268", "19994", "28450", "26876", "24063", "18066", "3220"
ORDER BY 
    GP_REFINTERNE
1

There are 1 best solutions below

1
On BEST ANSWER

Do you want in?

AND GL_ETABLISSEMENT in ('20897', '10519', '20267', '26451', '20269', '26078', '28047', '20900', '28085', '24984', '27113', '20268', '19994', '28450', '26876', '24063', '18066', '3220')

Note: use single quotes for literal strings instead of double quotes. This is standard SQL, which all databases support (while, in standard SQL, double quotes stand for identifiers).