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

Ken Schaefer ken at adOpenStatic.com
Tue May 25 07:42:09 CDT 2004


Sounds like sub-optimal table design to me. If you normalize the data, then
you'd just be able to put a criteria in your WHERE clause. Is normailizing
the data an option?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Richard Bennett" <richard.bennett at skynet.be>
Subject: Re: [thelist] is there something like eval() in my sql?


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