Syntax error while appending string separated by commas in mysql

后端 未结 3 1435
后悔当初
后悔当初 2021-01-25 22:31

I have following query

SELECT diamondsList.*, dealers.* FROM diamondsList JOIN dealers ON diamondsList.dealerId = dealers.id WHERE price >= :minPrice AND pric         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-25 23:05

    I have a string "SI2,VS1,SI1,VS2,VVS2,VVS1,IF,FL" How would i do this

    If you have values in CSV format, then you need FIND_IN_SET to search in it.

    Change:

    clarity IN (SI2,VS1,SI1,VS2,VVS2,VVS1,IF,FL)
    

    To:

    find_in_set( clarity, 'SI2,VS1,SI1,VS2,VVS2,VVS1,IF,FL' )
    

    And it seems, the same issue persists in some other parts of your query.
    You need to apply the same FIND_IN_SET on those parts.

提交回复
热议问题