0

I have been working on a program designed to read information from an Access database and display it on the screen. As my main development box doesn't have a copy of Access on it, I copied the data over to a PostgreSQL database and attempted to work from that. Now, having gotten the program working there, I was attempting to set it back up to receive data from the Access database.

My first SQL statement is throwing an error. The statement is "select distinct(deptCD) from sessionD where custID = '2' and dt >= '2004-1-01' and dt < '2004-3-31'". The error I am getting is 'Data type mismatch in criteria expression'. Would anyone please be willing to explain to me what it is I'm doing wrong with my statement?

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by CertGuard
0

It all depends on the datatypes you have set in the database table, but I see two issues in your statement.

1. INT types do not have ' around them
2. DATES are surrounded by #

Try this:

select distinct(deptCD) from sessionD where custID = 2 and dt >= #2004-1-01# and dt < #2004-3-31#
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.