Linked Questions

35 votes
5 answers
128k views

I face a problem with the function DATE_ADD in MySQL. My request looks like this : SELECT * FROM mydb WHERE creationdate BETWEEN "2011-01-01" AND DATE_ADD("2011-01-01", INTERVAL 6 MONTH) GROUP BY ...
BMN's user avatar
  • 8,576
2 votes
4 answers
5k views

I am trying to select rows that are in between two dates. First, here is my data: punch_id eid time unixtime punch_type day date doy 135 2 12:53 1314723193 0 ...
Devin's user avatar
  • 2,246
0 votes
6 answers
2k views

I have come across the following queries, but not sure if there is any difference between them, select * from table where date between fromdate and todate V/S select * from table where date >= ...
Will's user avatar
  • 13
0 votes
1 answer
1k views

After I run the following query: SELECT DATE_FORMAT( added_datetime, '%Y-%m-%d' ) AS date, SUM( gender = 'male' ) AS male, SUM( gender = 'female' ) AS female FROM social_user WHERE ...
mizan3008's user avatar
  • 379
1 vote
3 answers
2k views

Say I have four dates, for example: 1/1/2018 2/5/2018 4/8/2018 9/9/2018 I want to 'select' a date in between the min and max. Either the 2/5/2018 record or the 4/8/2018 record ONLY. I think I'm close,...
JWK's user avatar
  • 55
0 votes
2 answers
388 views

Consider this table named easy_drinks, +------------------+ | drink_name | +------------------+ | Kiss on the Lips | | Hot Gold | | Lone Tree | | Greyhound | | Indian ...
Suvarna Pattayil's user avatar
2 votes
4 answers
495 views

Lets say shop is working from 8:00 till 23:00 and we use time format. Then it's easy. Some kind of: where NOW() > start and NOW() < end But what if shop working until 1:00am next day? And now ...
Fortael's user avatar
  • 322
0 votes
1 answer
725 views

Stupid question maybe, but it drive me insane right now. Why User.where(:created_at => 1.day.ago..Time.now).count (0.8ms) SELECT COUNT(*) FROM "users" WHERE ("users"."created_at" BETWEEN '...
Dimillian's user avatar
  • 3,656
1 vote
1 answer
656 views

SQL Server query to get values between (from date) to (to date) with from date and to date. I had tried select * from abc where 1 = 1 and entrydate between '"txt1.Text"' and '"txt2.Text"' I get ...
balram's user avatar
  • 15
-1 votes
2 answers
460 views

I am trying to get all rows in a database which have been created between two dates inclusively. When I search for meetings in 2013-05-01 and todays date, I get no results but when I search without ...
wrichards0's user avatar
0 votes
2 answers
211 views

I am creating a Stored Procedure to get all the records from the previous 4 months, given the month and year variables. The datetime format of etimestamp column is 12/30/2020 12:000:00 AM. If inMonth &...
Jonnel VeXuZ Dorotan's user avatar
0 votes
1 answer
127 views

I am querying on date column in table 1 based on subqueries. Subquery 1 in where clause gets description from foreign key referred table and subquery 2 pulls in data by some other condition. So my ...
yoda's user avatar
  • 567
1 vote
2 answers
150 views

Hi I have a piece of code which looks up a year between to fields in the database which are year_start & year_end. And here is my code. SELECT * from $tableName where '$year' BETWEEN ...
Sam Williams's user avatar
0 votes
2 answers
100 views

Just curious if someone can give me some guidance with this issue of finding birthdates with MySQL. I currently have a 'calendar' that is setup, it shows 1 month + 3 days before and 3 days after that ...
Justin's user avatar
  • 2,542
0 votes
3 answers
108 views

I have data following data structure.. _ID _BEGIN _END 7003 99210 99217 7003 10225 10324 7003 ...
Nick LaMarca's user avatar
  • 8,228