質問編集履歴

3

era-

2023/02/24 06:03

投稿

ykkk
ykkk

スコア91

test CHANGED
File without changes
test CHANGED
@@ -38,7 +38,7 @@
38
38
  ->join('T_Site', 'T_Order.SiteId', '=', 'T_Site.SiteId')
39
39
  ->join('T_ClaimHistory', 'T_Order.OrderSeq', '=', 'T_ClaimHistory.OrderSeq')
40
40
  ->leftJoin('T_ClaimHistory', function($join){
41
- $join->on('T_ClaimHistory.OrderSeq', '=', 'T_ClaimHistory.OrderSeq', 'AND', 'T_ClaimHistory', 'T_ClaimHistory.Seq', '>', 'T_ClaimHistory.Seq', 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NULL');
41
+ $join->on('T_ClaimHistory.OrderSeq', '=', 'T_ClaimHistory.OrderSeq', 'AND', 'T_ClaimHistory', 'T_ClaimHistory.Seq', '>', 'T_ClaimHistory.Seq', 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NULL')
42
42
  ->where('T_Order.ClaimSendingClass', '=', 12, 'AND', 'T_Enterprise.SelfBillingMode IN(1,11)', 'AND', 'T_Site.SelfBillingFlg', '=', 1, 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NOT NULL', 'AND', 'T_ClaimHistory.ClaimPattern', '=', 1, 'AND', 'T_ClaimHistory.Seq IS NULL', 'AND', 'T_Order.OrderSeq ', '>', 60000000, 'AND', 'T_Order.Cnl_Status', '=', 0);
43
43
  })
44
44
  ->get();
@@ -50,28 +50,29 @@
50
50
  の部分にエディターで赤線がでて構文エラーになっております。
51
51
  実行時エラー
52
52
  ```ここに言語を入力
53
+ Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'T_ClaimHistory' (SQL: select distinct * from `T_Order` inner join `T_Enterprise` on `T_Order`.`EnterpriseId` = `T_Enterprise`.`EnterpriseId` inner join `T_Site` on `T_Order`.`SiteId` = `T_Site`.`SiteId` inner join `T_ClaimHistory` on `T_Order`.`OrderSeq` = `T_ClaimHistory`.`OrderSeq` left join `T_ClaimHistory` on `T_ClaimHistory`.`OrderSeq` = `T_ClaimHistory`.`OrderSeq` AND `T_Order`.`ClaimSendingClass` = 12)
53
54
 
54
- Symfony\Component\Debug\Exception\FatalThrowableError : syntax error, unexpected '->' (T_OBJECT_OPERATOR)
55
-
56
- at C:\Users\USER\backlogapi\app\Console\Commands\backlognotice15.php:48
57
- 44| ->join('T_Site', 'T_Order.SiteId', '=', 'T_Site.SiteId')
58
- 45| ->join('T_ClaimHistory', 'T_Order.OrderSeq', '=', 'T_ClaimHistory.OrderSeq')
59
- 46| ->leftJoin('T_ClaimHistory', function($join){
60
- 47| $join->on('T_ClaimHistory.OrderSeq', '=', 'T_ClaimHistory.OrderSeq', 'AND', 'T_ClaimHistory', 'T_ClaimHistory.Seq', '>', 'T_ClaimHistory.Seq', 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NULL');
61
- > 48| ->where('T_Order.ClaimSendingClass', '=', 12, 'AND', 'T_Enterprise.SelfBillingMode IN(1,11)', 'AND', 'T_Site.SelfBillingFlg', '=', 1, 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NOT NULL', 'AND', 'T_ClaimHistory.ClaimPattern', '=', 1, 'AND', 'T_ClaimHistory.Seq IS NULL', 'AND', 'T_Order.OrderSeq ', '>', 60000000, 'AND', 'T_Order.Cnl_Status', '=', 0);
62
- 49| })
63
- 50| ->get();
64
- 51| var_dump($datas);
55
+ at C:\Users\USER\backlogapi\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
56
+ 665| // If an exception occurs when attempting to run a query, we'll format the error
57
+ 666| // message to include the bindings with SQL, which will make this exception a
58
+ 667| // lot more helpful to the developer instead of just the database's errors.
59
+ 668| catch (Exception $e) {
60
+ > 669| throw new QueryException(
61
+ 670| $query, $this->prepareBindings($bindings), $e
62
+ 671| );
63
+ 672| }
64
+ 673|
65
65
 
66
66
  Exception trace:
67
67
 
68
- 1 Composer\Autoload\includeFile("C:\Users\USER\backlogapi\vendor\composer/../../app\Console\Commands\backlognotice15.php")
68
+ 1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'T_ClaimHistory'")
69
- C:\Users\USER\backlogapi\vendor\composer\ClassLoader.php:322
69
+ C:\Users\USER\backlogapi\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331
70
70
 
71
- 2 Composer\Autoload\ClassLoader::loadClass("App\Console\Commands\backlognotice15")
72
- [internal]:0
71
+ 2 PDO::prepare("select distinct * from `T_Order` inner join `T_Enterprise` on `T_Order`.`EnterpriseId` = `T_Enterprise`.`EnterpriseId` inner join `T_Site` on `T_Order`.`SiteId` = `T_Site`.`SiteId` inner join `T_ClaimHistory` on `T_Order`.`OrderSeq` = `T_ClaimHistory`.`OrderSeq` left join `T_ClaimHistory` on `T_ClaimHistory`.`OrderSeq` = `T_ClaimHistory`.`OrderSeq` AND `T_Order`.`ClaimSendingClass` = ?")
72
+ C:\Users\USER\backlogapi\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331
73
73
 
74
74
  Please use the argument -v to see more details.
75
+
75
76
  ```
76
77
 
77
78
 

2

era-

2023/02/24 05:48

投稿

ykkk
ykkk

スコア91

test CHANGED
File without changes
test CHANGED
@@ -48,5 +48,30 @@
48
48
  ->where('T_Order.ClaimSendingClass', '=', 12, 'AND', 'T_Enterprise.SelfBillingMode IN(1,11)', 'AND', 'T_Site.SelfBillingFlg', '=', 1, 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NOT NULL', 'AND', 'T_ClaimHistory.ClaimPattern', '=', 1, 'AND', 'T_ClaimHistory.Seq IS NULL', 'AND', 'T_Order.OrderSeq ', '>', 60000000, 'AND', 'T_Order.Cnl_Status', '=', 0);
49
49
  ```
50
50
  の部分にエディターで赤線がでて構文エラーになっております。
51
+ 実行時エラー
52
+ ```ここに言語を入力
53
+
54
+ Symfony\Component\Debug\Exception\FatalThrowableError : syntax error, unexpected '->' (T_OBJECT_OPERATOR)
55
+
56
+ at C:\Users\USER\backlogapi\app\Console\Commands\backlognotice15.php:48
57
+ 44| ->join('T_Site', 'T_Order.SiteId', '=', 'T_Site.SiteId')
58
+ 45| ->join('T_ClaimHistory', 'T_Order.OrderSeq', '=', 'T_ClaimHistory.OrderSeq')
59
+ 46| ->leftJoin('T_ClaimHistory', function($join){
60
+ 47| $join->on('T_ClaimHistory.OrderSeq', '=', 'T_ClaimHistory.OrderSeq', 'AND', 'T_ClaimHistory', 'T_ClaimHistory.Seq', '>', 'T_ClaimHistory.Seq', 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NULL');
61
+ > 48| ->where('T_Order.ClaimSendingClass', '=', 12, 'AND', 'T_Enterprise.SelfBillingMode IN(1,11)', 'AND', 'T_Site.SelfBillingFlg', '=', 1, 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NOT NULL', 'AND', 'T_ClaimHistory.ClaimPattern', '=', 1, 'AND', 'T_ClaimHistory.Seq IS NULL', 'AND', 'T_Order.OrderSeq ', '>', 60000000, 'AND', 'T_Order.Cnl_Status', '=', 0);
62
+ 49| })
63
+ 50| ->get();
64
+ 51| var_dump($datas);
65
+
66
+ Exception trace:
67
+
68
+ 1 Composer\Autoload\includeFile("C:\Users\USER\backlogapi\vendor\composer/../../app\Console\Commands\backlognotice15.php")
69
+ C:\Users\USER\backlogapi\vendor\composer\ClassLoader.php:322
70
+
71
+ 2 Composer\Autoload\ClassLoader::loadClass("App\Console\Commands\backlognotice15")
72
+ [internal]:0
73
+
74
+ Please use the argument -v to see more details.
75
+ ```
51
76
 
52
77
 

1

エラー

2023/02/24 05:37

投稿

ykkk
ykkk

スコア91

test CHANGED
File without changes
test CHANGED
@@ -43,6 +43,10 @@
43
43
  })
44
44
  ->get();
45
45
  ```
46
+ 現状
47
+ ```ここに言語を入力
48
+ ->where('T_Order.ClaimSendingClass', '=', 12, 'AND', 'T_Enterprise.SelfBillingMode IN(1,11)', 'AND', 'T_Site.SelfBillingFlg', '=', 1, 'AND', 'T_ClaimHistory.EnterpriseBillingCode IS NOT NULL', 'AND', 'T_ClaimHistory.ClaimPattern', '=', 1, 'AND', 'T_ClaimHistory.Seq IS NULL', 'AND', 'T_Order.OrderSeq ', '>', 60000000, 'AND', 'T_Order.Cnl_Status', '=', 0);
49
+ ```
50
+ の部分にエディターで赤線がでて構文エラーになっております。
46
51
 
47
52
 
48
-