Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using curdate in SELECT statement

Status
Not open for further replies.

kitfox69

Technical User
Aug 6, 2008
36
US
Hello all!

First I would like to say thanks to everyone who has posted here because I have found quite a few answers that I needed here on this forum that I have not found anywhere else.

THANKS YOU ALL!!

Now to my question.

I have recently installed PHP on a seperate server than our Pervasive SQL v 9.5 database and have written a few pages and queries to help our Customer Satisfaction Department gather delivery information that our Profit program makes difficult to access.

For testing purposes I have shortened the query to this and have successfully displayed the results in my web browser, see below.

SELECT DISTINCT sls_his_cust_id
FROM sls_his
where sls_his_prchdat_alt = 20080801

This works great but would require me to change the PHP scripting to include a form field for the person to manually enter the date they want to see the info for and have it in the yyyymmdd format.

I would much rather not have to rely on them to enter this and be able to use the curdate feature. What I am shooting for is something like curdate - 3 days so that it would pull the customer data for those deliveries done 3 days ago.

I was also thinking that instead of curdate I could use a max query on the sls_his_prchdat_alt column and subtract 3... would that work and if so how would the syntax look?
 
It looks like your date value is not a standard PSQL / Btrieve date data type. If that's the case, then you can create the data in the PHP code and pass it to the query. The PSQL CURDATE function will only return a value in the form yyyy-mm-dd.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Thanks... you are right it was just better to pass the date along with PHP since it is not a valid PSQL date format.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top