SQLTeam.com | Weblogs | Forums

Specify Date in table extraction

I am very new to using SQL. I am trying to extract data from the Micros 3700 database and am doing this successfully on interactive SQL. However, I am struggling to further specify the date. I want to have the latest day figures only. Preferably the same day.
I am using the following

SELECT *
FROM "micros"."v_R_sys_time_period"

to extract from the database. Is there a way to state which day I want displayed? Preferably the latest date.

Many thanks.

Yes. You add a WHERE clause to the SELECT to specify conditions for the SELECT. For example:

SELECT *
FROM "micros"."v_R_sys_time_period"
WHERE "column_name_with_the_date" >= TRUNC(CURRENT_DATE)

when I do this and subsitute the column_name... and current_date part it comes back with an error message saying Procedure 'TRUNC' not found

Sorry, I thought MICROS was an Oracle-related dbms and so would accept truncate.

Get rid of the TRUNC() and see what you get, although that may include the current time as well, which would ruin the results.

The key thing is to use a WHERE clause and to get the current date only, without the time, from some type of system variable and perhaps a function to strip the time.