tb/main #1
					 1 changed files with 42 additions and 39 deletions
				
			
		|  | @ -7,7 +7,9 @@ import ( | |||
| 
 | ||||
| func (database *Database) FindClaimsByProductID(product_id int) (claims []models.Claim, err error) { | ||||
| 	ctx := context.Background() | ||||
| 	err = database.db.Query(ctx, claims, `SELECT | ||||
| 
 | ||||
| 	err = database.db.Query(ctx, claims, ` | ||||
|         SELECT | ||||
|             cluster, | ||||
|             id, | ||||
|             worker_type, | ||||
|  | @ -17,7 +19,7 @@ func (database *Database) FindClaimsByProductID(product_id int) (claims []models | |||
|             polarity, | ||||
|             created_at, | ||||
|             created_by | ||||
| FROM ( | ||||
|         FROM ( | ||||
|             SELECT | ||||
|                 cluster, | ||||
|                 id, | ||||
|  | @ -43,10 +45,11 @@ FROM ( | |||
|                 ) | ||||
|             ) | ||||
|             WHERE product_id = ? | ||||
| ) | ||||
| WHERE rn = 1 | ||||
| ORDER BY created_at; | ||||
| `, product_id) | ||||
|         ) | ||||
|         WHERE rn = 1 | ||||
|         ORDER BY created_at; | ||||
|     `, product_id) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		return claims, err | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue