mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.52k stars 307 forks source link

A column created by "COUNT(*)" uses string comparison instead of int comparison in result page #715

Open ZZYSonny opened 4 years ago

ZZYSonny commented 4 years ago

Describe the bug A column created by "COUNT(*)" uses string comparison instead of int comparison in result page.

To Reproduce Steps to reproduce the behavior:

  1. Create a SQL file and add the following code
    SELECT sid, COUNT(*) * 9
    FROM enroll
    GROUP BY sid
  2. Click on 'Run on active connection'
  3. Select "< less than" in ?column? (the column created by COUNT(*)) and input 9
  4. 27,18 included after applying the filter image

Expected behavior 27,18 should not be included in the result Since there is no 0 in the COUNT column, after applying the filter, there should be no rows in the result. Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

B4Art commented 4 years ago

What is the result if you use: SELECT sid, CAST(COUNT(*) * 9 AS int) FROM enroll GROUP BY sid

ZZYSonny commented 4 years ago

What is the result if you use: SELECT sid, CAST(COUNT(*) * 9 AS int) FROM enroll GROUP BY sid

Comparision works perfectly. It uses int comparision. image