<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Is there a really good reason for having each day in a separate
table? If not put all the data in a single table with a field for
the date and your query turns into "select * form
tnt_audi.summaryreport_login_stats where datefield*=(CURRENT_DATE)"
<br>
<br>
*datefield is whatever the date field becomes.<br>
<br>
If there is a really good reason I would be happy to try harder but
would like to know that there really is a reason.<br>
<br>
<br>
<br>
David Hoppe<br>
<br>
<br>
<br>
On 4/12/2011 2:10 PM, Richard Maloley II wrote:
<blockquote
cite="mid:BANLkTi=PJJ=wbG_DXTo2K8R02Fes-pr38Q@mail.gmail.com"
type="cite">Hello,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>SELECT * FROM tnt_audit.summaryreport_login_stats_20110412; </div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>
<div>SELECT</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>*</div>
<div>FROM</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>tnt_audit.summaryreport_login_stats_(CURRENT_DATE)</div>
<div>;</div>
</div>
<div><br>
</div>
<div>However this results in the following error message:</div>
<div><br>
</div>
<div>
<div>ERROR: function tnt_audit.summaryreport_login_stats_(date)
does not exist</div>
<div>LINE 4: tnt_audit.summaryreport_login_stats_(CURRENT_DATE)</div>
<div> ^</div>
<div>HINT: No function matches the given name and argument
types. You might need to add explicit type casts.</div>
<div><br>
</div>
<div>********** Error **********</div>
<div><br>
</div>
<div>ERROR: function tnt_audit.summaryreport_login_stats_(date)
does not exist</div>
<div>SQL state: 42883</div>
<div>Hint: No function matches the given name and argument
types. You might need to add explicit type casts.</div>
<div>Character: 17</div>
</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Thanks,</div>
<div><b>Richard Maloley II</b>
<div><i>Rick and Richard Computer Consulting</i></div>
<div>p: 616-745-6914</div>
<div>e: <a moz-do-not-send="true"
href="mailto:richard@rrcomputerconsulting.com"
target="_blank">richard@rrcomputerconsulting.com</a></div>
<div>w: <a moz-do-not-send="true"
href="http://www.rrcomputerconsulting.com" target="_blank">http://www.rrcomputerconsulting.com</a></div>
<div><br>
</div>
<br>
</div>
<br>
-- <br>
This message has been scanned for viruses and
<br>
dangerous content by
<a moz-do-not-send="true" href="http://www.mailscanner.info/"><b>MailScanner</b></a>,
and is
<br>
believed to be clean.
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
grlug mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grlug@grlug.org">grlug@grlug.org</a>
<a class="moz-txt-link-freetext" href="http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug">http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug</a></pre>
</blockquote>
<br>
<br />--
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.
</body>
</html>