Skip to content

Tag: between

NULL MAX(col) value even though DB has a valid record

So I am trying to extract the maximum invoiceNo for current year and this is how I implemented it with PDO: However, $response keeps getting assigned to the else clause : . This is how my DB looks like: Hence I was expecting the $response to be 2022-2. I think there is something wrong with my SQL query and I

Select range in SQL

I have a sql database that have InvoiceNumber column Now i need to select range between two numbers, but i don’t know what happened. I’ve tried “Between” and “<= , >=” Statements but the results are same. Table My query For example: If i need range between “13000” and “13020” and there is number “1301” its appear in results. Answer

ASP classic select date BETWEEN dates on SQL Server

I run the next query in my classic asp code and it run perfect. it returns results between the days “from” and “to” However,I cannot find out what is wrong with the next query: I want it to return the results of the last week that are recorded in the database. Any Ideas? The query is ok when i run

Select all rows between dates

I have a #tmp table that looks like the following. It has a total of three lines. title receipt_date decision_date “It wasn’t as bad as I thought it would be” 2017-06-12 15:07:10.893 2017-06-23 09:37:31.667 “It wasn’t as bad as I thought it would be” 2017-07-11 10:35:24.337 2018-06-25 05:54:41.133 “It wasn’t as bad as I thought it would be” 2017-09-25 14:06:18.670

Check whether a number is in a string range

I have a table ID Count Range 1 33 1-100 2 120 101-200 3 155 201-300 The Range is a string that can only have the values 1-100, 101-200, 201-300. I need to write a query that checks whether the count and the range fits, so 155 should pop up. My idea was: but this does not work. Can anyone