[thelist] is there something like eval() in my sql?

Richard Bennett richard.bennett at skynet.be
Tue May 25 07:29:44 CDT 2004


On Tuesday 25 May 2004 14:34, Manuel González Noriega wrote:
> > I am trying to open a table whose name can be variable, but am having
> > trouble getting this to work:
>
> It seems to me you're gonna have to pass the variable part of the table
> name from PHP anyway, so i suggest PHP be it :)

Yeah, but the variable would be a logical value, like the 'day' part of the 
current date, something like this:

SELECT * FROM CONCAT("table",datepart(dd,date()))

That should open table: table1, table2, table3 etc, depending on the current 
date.

I could do it in php of course, but this seems like something pretty basic, 
that should be able to be done in SQL as well... 

Thanks anyway,

Richard.


More information about the thelist mailing list