Title: SQL Statement
Last modified: August 31, 2016

---

# SQL Statement

 *  Resolved [Stefan Joachim](https://wordpress.org/support/users/stefan-joachim/)
 * (@stefan-joachim)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/sql-statement/)
 * Hi,
    I try to add for the export a field based on a SQL Query. I want to use 
   the ID from the current object to select an item. I tried this: SELECT post_id
   FROM wp_postmeta WHERE meta_key LIKE ‘_wpcf_belongs_anbieter_id’ AND meta_value
   = ID Limit 1; But this doesn’t work. If I change from ID to 153 ( the id 🙂 )
   it works well. I use a wp-types custom post type.
 * Thanks for support
    Stefan
 * [https://wordpress.org/plugins/wp-all-export/](https://wordpress.org/plugins/wp-all-export/)

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

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/sql-statement/#post-7067707)
 * Hi Stefan,
 * You can use %%ID%% as a placeholder. For example:
 * > SELECT post_title FROM wp_posts WHERE ID = %%ID%%
 *  Thread Starter [Stefan Joachim](https://wordpress.org/support/users/stefan-joachim/)
 * (@stefan-joachim)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/sql-statement/#post-7067721)
 * [solved]
    Thanks a lot for information, it works fine!
 * Stefan

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

The topic ‘SQL Statement’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-export/assets/icon-256x256.png?rev=2570162)
 * [WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel](https://wordpress.org/plugins/wp-all-export/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-export/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-export/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-export/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-export/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-export/reviews/)

## Tags

 * [request](https://wordpress.org/support/topic-tag/request/)
 * [sql-query](https://wordpress.org/support/topic-tag/sql-query/)

 * 2 replies
 * 2 participants
 * Last reply from: [Stefan Joachim](https://wordpress.org/support/users/stefan-joachim/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/sql-statement/#post-7067721)
 * Status: resolved