Title: SQL statement differnce betweem old and new.
Last modified: February 11, 2025

---

# SQL statement differnce betweem old and new.

 *  Resolved [andys007](https://wordpress.org/support/users/andys007/)
 * (@andys007)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/sql-statement-differnce-betweem-old-and-new/)
 * Hi is have a data table that works fine with the SQL Statement in Where
   Club 
   = “Burn” AND Season = “24” AND Private = “Yes” AND WP_User_ID = @wpda_wp_user_id
   OR @wpda_wp_user_id = “1” OR @wpda_wp_user_id = “4”
 * It works as below
 * CREATE VIEW Burn_Catches as
   Select Name,Date,Hours,Trout_4,Trout4_10,Trout_10,
   Grayling_4,Grayling4_10,Grayling_10,Section from Catches where Club = “Burn” 
   AND Season = “24” AND Private = “Yes”
 * but when I append AND WP_User_ID = @wpda_wp_user_id OR @wpda_wp_user_id = “1”
   OR @wpda_wp_user_id = “4”
   I get **WordPress database error:** View’s SELECT contains
   a variable or parameterI am sure it’s to do with SQL somewhere, but not sure,
   can you advise please?Thanks
 * Andy

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Kim L](https://wordpress.org/support/users/kimmyx/)
 * (@kimmyx)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/sql-statement-differnce-betweem-old-and-new/#post-18301181)
 * Hi [@andys007](https://wordpress.org/support/users/andys007/),
 * Thanks for the post.
 * Variables are not allowed in CREATE VIEW statements. It’s a limitation as stated
   here: [https://dev.mysql.com/doc/refman/5.7/en/create-view.html](https://dev.mysql.com/doc/refman/5.7/en/create-view.html)
 * Some users use a workaround to bypass this limitation, although it’s usually 
   not advisable. For example: [https://stackoverflow.com/questions/2281890/can-i-create-view-with-parameter-in-mysql](https://stackoverflow.com/questions/2281890/can-i-create-view-with-parameter-in-mysql)
 * We hope that helps. 🙏 Let us know if you have other questions.
 *  [jkacher](https://wordpress.org/support/users/jkacher/)
 * (@jkacher)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/sql-statement-differnce-betweem-old-and-new/#post-18401319)
 * you might try ‘and @wpda_wp_user_id  in (‘1′,4,’,10′,)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SQL statement differnce betweem old and new.’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [jkacher](https://wordpress.org/support/users/jkacher/)
 * Last activity: [1 year, 1 month ago](https://wordpress.org/support/topic/sql-statement-differnce-betweem-old-and-new/#post-18401319)
 * Status: resolved