这听起来很奇怪,但是我需要通过更改几个值将数据库中的表中的行范围复制到同一表中。
我的主要问题是与/** Group by one day method 1 **/
SELECT
SUM(Id) AS Id,
DATEADD(DAY, 0, DATEDIFF(DAY, 0, DateTime)) AS DateTime
FROM
Reporting
GROUP BY
DATEADD(DAY, 0, DATEDIFF(DAY, 0, DateTime))
ORDER BY
DateTime DESC
/** Group by one day method 2 **/
SELECT
SUM(Id) AS Id,
MIN(DATEADD(DAY, 0, DATEDIFF(DAY, 0, DateTime))) AS DateTime
FROM
Reporting
GROUP BY
DATEPART(YEAR, DateTime),
DATEPART(MONTH, DateTime),
DATEPART(DAY, DateTime)
ORDER BY
DateTime DESC
列有关。他们希望这些行的标识以特定的数字开头,但通过应用程序输入数据不应更改正常顺序。
基本上:
我有办法吗?
答案 0 :(得分:1)
DBCC CHECKIDENT可以强制当前标识值。参见here:
protected $fillable = [
'parent_id', 'user_id', 'post_id', 'name', 'email', 'website', 'body', 'approved'
];
public function user()
{
return $this->belongsTo(User::class);
}
public function post()
{
return $this->belongsTo(Post::class);
}
public function commentable()
{
return $this->morphTo();
}
public function comments()
{
return $this->morphMany(Comment::class,'commentable');
}