I have a table with dynamically generated column headers based on the current date:CustomerID, Apr_2011, Mar_2011, Feb_2011, Jan_2011, Dec_2010, Nov_2010
I am joining this table to my customer table but I'm not quite sure how to select the dynamically generated column names.SELECT c.CustomerName,c.CustomerCity,t.Month_Year1 --> Apr_2011,t.Month_Year2 --> Mar_2011, etc.FROM Customers cINNER JOIN SalesTable t ON c.CustomerID = t.CustomerID
Since the month columns are always changing, how can I find out what column names to put into my query. Thanks for any help you can provide.