[GRLUG] Postgresql help
Richard Maloley II
richard at rrcomputerconsulting.com
Tue Apr 12 14:10:42 EDT 2011
Hello,
I'm trying to create a really simple query against a Postgresql database.
This database creates a new table every single day for daily statistics,
therefore all tables are named the same except for the different date
appended to the name.
My query right now is simple: Execute a single SQL statement that will
gather data from the correct daily table depending on the day. For example:
SELECT * FROM tnt_audit.summaryreport_login_stats_20110412;
The above query will select all of the data for today. The date piece,
20110412, needs to be dynamically changed. Here is what I thought of:
SELECT
*
FROM
tnt_audit.summaryreport_login_stats_(CURRENT_DATE)
;
However this results in the following error message:
ERROR: function tnt_audit.summaryreport_login_stats_(date) does not exist
LINE 4: tnt_audit.summaryreport_login_stats_(CURRENT_DATE)
^
HINT: No function matches the given name and argument types. You might need
to add explicit type casts.
********** Error **********
ERROR: function tnt_audit.summaryreport_login_stats_(date) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need
to add explicit type casts.
Character: 17
I'm no SQL expert and I've been unable to find any direction on how to
accomplish this. I feel as though it should be simple to append this data to
the table name but the answer eludes me. For reference we are using version
8.x of the database.
Thanks,
*Richard Maloley II*
*Rick and Richard Computer Consulting*
p: 616-745-6914
e: richard at rrcomputerconsulting.com
w: http://www.rrcomputerconsulting.com
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shinobu.grlug.org/pipermail/grlug/attachments/20110412/e94a7d62/attachment.html>
More information about the grlug
mailing list