Home > Mobile >  Select giving different results with different date formats
Select giving different results with different date formats

Time:06-09

I'm building a query on SQL Server, and I have the following line:

SELECT ISNULL(CONVERT(INT, SUM(fi.qtt)), 0)
FROM   fi,
       st
WHERE  st.ref = fi.ref
       AND rdata LIKE ' 21%' 

which works like a charm. Only thing going wrong is that instead of definig the year (2021) I want it to get last year results. So I got to this point:

SELECT ISNULL(CONVERT(INT, SUM(fi.qtt)), 0)
FROM   fi,
       st
WHERE  st.ref = fi.ref
       AND rdata LIKE '           
  • Related