Reputation: 1078
I have to produce a pretty complex report. Without a doubt someone will ask me for the individual records that make up the counts, totals etc.
Im new to mySql. I have tried and found out that I can store Sql statements as data of type Text without any real problems.
Being able to do it, however begs the main question:
Is this a good idea? Is there anything here that will hit me with a "Got ya!"
(Its always what you don't know that gets you, never what you do know)
The report will return Sales Count: 5
I would Live to store "SELECT * FROM Sales WHERE Producer_ID = 34" so I can quickly get to the 34 records that make up the 5 Sales count
Upvotes: 0
Views: 92
Reputation: 26281
Storing SQL queries as data in a SQL DB is sometimes labelled dynamic SQL queries. It is prone to injection issues, and should not be undertaken lightly. I recommend not doing so unless you have a very good reason to do so.
Upvotes: 2