How do I compare two columns in the same table?

前端 未结 1 875
遥遥无期
遥遥无期 2020-12-16 23:24

I would like to compare two columns in the same table. I want to be able to return all rows where the two columns have the same value.

I am looking for something li

相关标签:
1条回答
  • 2020-12-17 00:11

    SELECT * FROM FOO WHERE C1 = C4 should work. Does it not?

    If not, are they the same data type and length? You may need to convert.

    I don't know about WebSql, but I've seen some db systems that refuse to match if one is a varchar(5) and the other is a varchar(10) even though they hold the same value. In those systems you have to use something like

     Convert(varchar, 10, FieldName)
    

    to get a match.

    0 讨论(0)
提交回复
热议问题