Anyone can explain the following?
Table definition:
CREATE TABLE testdate
(
SalesDate DATETIME,
SalesTotal DOUBLE,
PRIMARY KEY (SalesDate)
)
If I use the following SQL statement I get results:
SELECT * FROM testdate
WHERE SalesDate = '2003-08-27' OR SalesDate='2003-07-27';
But I get an empty set when I use this:
SELECT * FROM testdate
WHERE SalesDate IN ('2003-08-27', '2003-07-27');
This happens on both 4.0.15 and 3.23.57.
But the above statements work the same under Microsoft SQL Server.
Why is MySQL interpreting WHERE IN and WHERE = OR = differently?
Thanks, 2 14964
According to the manual, the IN search is performed using a binary
comparison, so it's possible I guess that the SalesDate column isn't
giving the correct output for the comp operation.
This does work though:
SELECT * FROM testdate
WHERE date_format(`SalesDate`,'%Y-%m-%d')
IN('2003-08-27', '2003-07-27');
Jim Min wrote: Anyone can explain the following?
Table definition:
CREATE TABLE testdate ( SalesDate DATETIME, SalesTotal DOUBLE, PRIMARY KEY (SalesDate) )
If I use the following SQL statement I get results:
SELECT * FROM testdate WHERE SalesDate = '2003-08-27' OR SalesDate='2003-07-27';
But I get an empty set when I use this:
SELECT * FROM testdate WHERE SalesDate IN ('2003-08-27', '2003-07-27');
This happens on both 4.0.15 and 3.23.57. But the above statements work the same under Microsoft SQL Server.
Why is MySQL interpreting WHERE IN and WHERE = OR = differently?
Thanks,
According to the manual, the IN search is performed using a binary
comparison, so it's possible I guess that the SalesDate column isn't
giving the correct output for the comp operation.
This does work though:
SELECT * FROM testdate
WHERE date_format(`SalesDate`,'%Y-%m-%d')
IN('2003-08-27', '2003-07-27');
Jim Min wrote: Anyone can explain the following?
Table definition:
CREATE TABLE testdate ( SalesDate DATETIME, SalesTotal DOUBLE, PRIMARY KEY (SalesDate) )
If I use the following SQL statement I get results:
SELECT * FROM testdate WHERE SalesDate = '2003-08-27' OR SalesDate='2003-07-27';
But I get an empty set when I use this:
SELECT * FROM testdate WHERE SalesDate IN ('2003-08-27', '2003-07-27');
This happens on both 4.0.15 and 3.23.57. But the above statements work the same under Microsoft SQL Server.
Why is MySQL interpreting WHERE IN and WHERE = OR = differently?
Thanks,
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jim Min |
last post by:
Anyone can explain the following?
Table definition:
CREATE TABLE testdate
(
SalesDate DATETIME,
SalesTotal DOUBLE,
PRIMARY KEY (SalesDate)
)
|
by: Shaun |
last post by:
Hi,
I have a table called Bookings which has two important columns;
Booking_Start_Time and Booking_End_Time. These columns are both of type
DATETIME. Given any day how can I calculate how many...
|
by: Kieran Dutfield |
last post by:
Code:
ALTER PROCEDURE GetBookings
(
@CurrentDate datetime,
@Catergory char(10)
)
AS
SELECT BookingId, StartDate, PeriodStart, Catergory, Staff, Resource,
Class, @CurrentDate AS Expr1
|
by: Paulo Jan |
last post by:
Hi all:
I have here a table with the following schema:
Table "todocinetv"
Column | Type | Modifiers...
|
by: Lad |
last post by:
I use datetime class in my program and now
I have two fields that have the datetime format like this
datetime.datetime(2006, 5, 24, 16, 1, 26)
How can I find out the date/time difference ( in...
|
by: bbawa1 |
last post by:
Hi,
I have a table which has a field ItemsReceived of type datetime. I
have a grid view which has two columns.
In first column i have to show the data from field ItemsReceived and
in second...
|
by: Irfan Mughal |
last post by:
i need ur help.
i want to have CPU utilization of last 24 hrs. for time being i want
to have result from 1 server.
select "AVG_%_Total_Processor_Time", "WRITETIME", "MAX_...
|
by: bobh |
last post by:
Hi All,
Is there a difference in preformance between the two;
TblNme has 36 fields across a record
a query that selects all fields and the report only uses 75% of the
fields, ie; Select...
|
by: Joey Fontaine |
last post by:
I just noticed that, when using intellisense, the DateTime.MaxValue
field has a static property icon whereas the Decimal.MaxValue field
has a constant property icon. However, when looking at the...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |