这是我的桌子。我只是想要一个select语句,它返回优惠券代码、max\\u uses和times\\u used。我不知道如何加入这一切来做到这一点。
mysql> select * from wp_postmeta where post_id = \'207717\';
+---------+---------+------------------------+-------------------------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+------------------------+-------------------------------+
| 795679 | 207717 | coupon_code | emeraldcity |
| 795689 | 207717 | max_uses | 30 |
| 795699 | 207717 | start_date | 2016-07-22 |
| 795704 | 207717 | _end_date | WPMUDEV_Field_Datepicker |
| 795705 | 207717 | _edit_lock | 1492003198:1 |
| 913311 | 207717 | times_used | 22 |
+---------+---------+------------------------+-------------------------------+
例如,这让我知道max\\u使用的是什么。
mysql> select * from wp_postmeta where post_id = \'207717\' and meta_key = \'max_uses\';
+---------+---------+----------+------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+----------+------------+
| 795689 | 207717 | max_uses | 30 |
+---------+---------+----------+------------+