Questions tagged [between]

The SQL BETWEEN Operator selects values within a range. The values can be numbers, text, or dates. Is possible to select values outside a range using NOT BETWEEN. The BETWEEN operator can produce different result in different databases: In some databases excludes the test values, in some others include them and in some cases includes the first test value and excludes the last one.

1363 questions
-2
votes
2 answers

using LIKE and BETWEEN in sql query

alter PROCEDURE [dbo].[select_User_attendance_master_Date] ( @From_date NVarchar(100), @To_date NVarchar(100) ) as begin select Employee_Attendace_Code, …
-2
votes
2 answers

Syntax error when using parentheses with BETWEEN

I thought that the following would be the way I search for all calls placed in a 10 minute time frame SELECT * FROM `call_log` WHERE start_time BETWEEN ('2012-05-01 17:50:00' AND '2013-05-01 18:00:00') However when I run this query I get the…
RussellHarrower
  • 6,470
  • 21
  • 102
  • 204
-2
votes
2 answers

MySQL using BETWEEN clause with AND clause & OR clause

I want to run a query where you select every data between date1 to date2 that has status of Confirmed or Reserved grouped by status. But the code I'm trying, select * from reservation where (date(bdate) between '2013-2-4' and '2013-2-8') and…
xjshiya
  • 915
  • 7
  • 16
  • 44
-2
votes
1 answer

select records between 2 bigint values fastest way - so use c# objects instead of querying database

Alright i have a table which contains 2 bigint column. Example val1 3213 12312 val2 13232 32322 . . . select val from table where 3232 between col1 and col2 I need to use between operator to select single row data. Now i tried dataview but it…
Furkan Gözükara
  • 22,964
  • 77
  • 205
  • 342
-2
votes
1 answer

How to get the values in between a particular range timestamps

I have table in SQL Server 2008 called ,timestamplog which contains one column of name LogTime of typeINTEGER` The values are like this: 1350468610, 1350468000, 1350381600, 1350295810 I need the values in between 1350468609 and 1350468001.. Please…
user1716577
  • 29
  • 1
  • 7
-2
votes
1 answer

Search comma separated value using between clause

I have a table called dayofweek, in which data is stored in the following format, comma separated. id friday saturday sunday monday tuesday winsday 1 02:00,3:09 1:12,2:9 3:08,4:08 3:3,3:45 12:3,3:2 …
-3
votes
2 answers

SQL results for all rows between two dates

I'm stuck with a SQL query. I have a situation like this: in the bookings table. I have two simple DATETIME columns date_start and date_end, and I have two datepickers where the user can select those two dates and values from them we should call…
Miljan Puzović
  • 5,840
  • 1
  • 24
  • 30
-3
votes
1 answer

MySQL error getting total values between two dates and another filter

I want to get SUM values from a table between two dates but I have another filter also. I am getting syntax error and could not find what is wrong. This is the SQL sentence: SUM(IF((date BETWEEN '2020-01-01 00:00:00' AND '2020-01-31 23:59:59') AND…
Arda Balkan
  • 1
  • 1
  • 4
-3
votes
1 answer

Problems with BETWEEN dates operator

I am practising and experimenting with different syntax of SQL BETWEEN operator in regards to dates from the "https://www.w3schools.com/sql/sql_between.asp" This is the Order table in my database: LINK:…
Saumyojit Das
  • 101
  • 1
  • 7
-3
votes
2 answers

get records between from a start to end number

This SQL return all records as (JSON) from 2 tables "posts_main" and "posts_comments" that depends on specific User $sql = "select posts_main.*, (select groupid from posts_comments where groupid = posts_main.id group by groupid ) as…
Fadi
  • 61
  • 8
-3
votes
2 answers

How to count days between 2 rows multiple scenarios

I would like to count days from table like this: []]1 I have 2 columns with status and date, I need to count how many days one row had status with 1 and 3, for example: first row has staus 1 second row has status 2 the difference between those two…
-3
votes
1 answer

Java GregorianCalendar check if a day is between other two

Let's say I have two GregorianCalendar dates with the year, the month and the day from the month and they give me another GregorianCalendar date. Is there a defined method to check if the given date is between the other two dates? If not, would I…
Unknown
  • 39
  • 2
  • 9
-3
votes
1 answer

BETWEEN clause breaking with PDO and MySQL

I migrated this over from mysql to PDO. When I test this query by putting 2 and 19 into the WHERE Clause in place of :id3 and :id4, it works just fine. But when I do it 'correctly' with the :ids, it breaks and I can't spot my error. Further…
AllThisOnAnACER
  • 331
  • 1
  • 4
  • 18
-3
votes
1 answer

php regex string between

I have this string: and i need gegi123 I tried this: /
-3
votes
1 answer

Msg 102, Level 15, State 1, Line 5 Incorrect syntax near '#'

UPDATE tblAlbum SET dateAlbumReleaseDate = '12/1/2003' WHERE dateAlbumReleaseDate BETWEEN #6/1/2002# AND #11/31/2002# AND IngAlbumID IN (SELECT a.IngAlbumID FROM tblAlbum a, …
user2989009
  • 3
  • 1
  • 2
1 2 3
90
91