需要LIKE运营商关于JOIN的建议

时间:2016-09-13 05:37:47

标签: sql mysql-workbench

我有两个数据表,一个包含客户数据,如客户ID和使用的红利代码。第二个表是内部注释,我写的关于客户的每个注释都在那里,例如:给客户12个红利代码GFT100。 知道我需要根据红利代码加入这两张表,我想要玩家用来在笔记表中找到相关注释的每个红利代码。

表1:使用的红利代码

-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{

-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
}

表2:客户备注

CustomerID | Coupon_Code | DateOfUsege      
--------------------------------------       
    12     |   AAA25     | 2016-09-10         
-------------------------------------
    12     |   BBB13     | 2016-09-10
--------------------------------------
    17     |   CCC14     | 2016-09-10

所需输出:对于表1中的每个使用代码,仅添加表2中的相关注释

CustomerID|   Date   |         Text
---------------------------------------------
   12     |2016-09-07| Gave bonus AAA25     
----------------------------------------------
   12     |2016-09-07| Very good customer
----------------------------------------------
   17     |2016-09-06| Gave bonus code CCC14 

我该怎么做?

1 个答案:

答案 0 :(得分:0)

我建议在您的笔记表中添加一个可空的 /** * Execute ext_localconf.php files from extensions * * @return void */ protected static function loadSingleExtLocalconfFiles() { // This is the main array meant to be manipulated in the ext_localconf.php files // In general it is recommended to not rely on it to be globally defined in that // scope but to use $GLOBALS['TYPO3_CONF_VARS'] instead. // Nevertheless we define it here as global for backwards compatibility. global $TYPO3_CONF_VARS; foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) { if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess) && isset($extensionInformation['ext_localconf.php'])) { // $_EXTKEY and $_EXTCONF are available in ext_localconf.php // and are explicitly set in cached file as well $_EXTCONF = isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]) ? $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] : null; require $extensionInformation['ext_localconf.php']; } } } 列(假设一个笔记可能只与零个或一个优惠券代码相关),并在适用时记录每个笔记的可选代码。在自由文本值中搜索代码可能会返回误报

...但是,这次加入应该让你开始

coupon_code