Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP TABLE IF EXISTS `org_apiinteg_assets`;
- DROP TABLE IF EXISTS `assessmentinstances`;
- CREATE TABLE `org_apiinteg_assets` (
- `id` varchar(20) NOT NULL default '0',
- `instance_id` varchar(20) default NULL,
- PRIMARY KEY (`id`)
- ) ENGINE= MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=1;
- CREATE TABLE `assessmentinstances` (
- `id` varchar(20) NOT NULL default '0',
- `title` varchar(180) default NULL,
- PRIMARY KEY (`id`)
- ) ENGINE= MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=1;
- insert into assessmentinstances(id, title) values ('14026lvplotw6','One radio question survey');
- insert into org_apiinteg_assets(id, instance_id) values ('8kp9wgx43jflrgjfe','14026lvplotw6');
- assessmentinstances
- +---------------+---------------------------+
- | id | title |
- +---------------+---------------------------+
- | 14026lvplotw6 | One radio question survey |
- +---------------+---------------------------+
- org_apiinteg_assets
- +-------------------+---------------+
- | id | instance_id |
- +-------------------+---------------+
- | 8kp9wgx43jflrgjfe | 14026lvplotw6 |
- +-------------------+---------------+
- SELECT ai.id, COUNT(*) AS `count`
- FROM assessmentinstances ai INNER JOIN org_apiinteg_assets a
- ON a.instance_id = ai.id
- WHERE ai.id = '14026lvplotw6'
- AND a.id != '8kp9wgx43jflrgjfe';
- null, 0
- '14026lvplotw6','0'
Add Comment
Please, Sign In to add comment