Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query="SET @laboratory_prefix_id = 5;
- SET @min_sample_number = 1;
- (
- SELECT @count
- FROM sample, (select @count := @min_sample_number-1) dummy
- WHERE sample.laboratory_prefix_id = @laboratory_prefix_id
- AND sample.sample_number > @min_sample_number-1
- AND (@count := @count+1) < sample.sample_number
- ORDER BY sample.sample_number ASC
- LIMIT 1
- )
- UNION ALL
- (
- SELECT @min_sample_number
- )
- ORDER BY 1 DESC
- LIMIT 1;";
- $rows = Yii::$app->db->createCommand($query)->queryAll();
- $rows = Yii::$app->db->createCommand('SET @laboratory_prefix_id = 5;')->execute();
- $rows = Yii::$app->db->createCommand('SET @min_sample_number = 1;')->execute();
- $rows = Yii::$app->db->createCommand($query)->queryAll();
- (
- SELECT @count
- FROM sample, (select @laboratory_prefix_id := ?
- , @min_sample_number := ?
- , @count := @min_sample_number-1) dummy
- WHERE sample.laboratory_prefix_id = @laboratory_prefix_id
- AND sample.sample_number > @min_sample_number-1
- AND (@count := @count+1) < sample.sample_number
- ORDER BY sample.sample_number ASC
- LIMIT 1
- )
- UNION ALL
- (
- SELECT @min_sample_number
- )
- ORDER BY 1 DESC
- LIMIT 1;
- $rows = Yii::$app->db->createCommand('SET @laboratory_prefix_id = 5;')->execute();
- $rows = Yii::$app->db->createCommand('SET @min_sample_number = 1;')->execute();
- $rows = Yii::$app->db->createCommand($query)->queryAll();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement