Last active
August 7, 2017 18:52
-
-
Save MagePsycho/5f56fa0a4ffeba9109510e27520cf80c to your computer and use it in GitHub Desktop.
MySQL: Dynamic Table + SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @author Raj KB | |
-- @website http://blog.magepsycho.com | |
SET @STORE_ID = 7; | |
SET @CATALOG_FLAT_TABLE = CONCAT('catalog_product_flat_', @STORE_ID); | |
SET @QUERY = CONCAT('SELECT * FROM ', @CATALOG_FLAT_TABLE, ' LIMIT 10'); | |
PREPARE stmt FROM @QUERY; | |
EXECUTE stmt; | |
DEALLOCATE PREPARE stmt; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment