SQL:如何在同一个表的另一行中重用id?

时间:2018-01-07 21:24:00

标签: sql hsqldb

我是新手&在收据数据库上工作。

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/css/bootstrap.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<html>
  <body ng-app="myApp" ng-controller="myController">
    <a ng-click="addQuizQuestion()">
      <i class="fa fa-plus"></i>&nbsp;Add new input
   </a> 
  <div ng-repeat="item in questionQuiz track by $index">
    <div class="input-group">
      <div class="input-group-addon"></div> 
      <input type="text" ng-pattern="/\.(png|jpeg|jpg)$/" name="image"
             class="form-control" ng-model="imagePath[$index]"
             placeholder="Choose image or link">
      <span class="input-group-btn">        
       <span class="btn btn-default btn-file add-img-upload">
       <input id="selectImage" type="file" name="myfile"
              ng-disabled="uploading" file-model="file.upload" id="imgInp"
              onchange="angular.element(this).scope().PhotoChanged(this.files)">
             <span ng-click="clearImage()"><i class="fa fa-trash" aria-hidden="true"></i></span> 
      </span>
      </span>
      </div>
    </div> 
  
  </body>
</html>

如何插入例如苹果并使用香蕉的id作为alternative_ID列?

1 个答案:

答案 0 :(得分:2)

您只需插入值:

ready() {
  { // Set scroll target for <iron-scroll-threshold>
    let myApp = document.querySelector('my-app');
    let appHeader = myApp.shadowRoot.querySelector('app-header');

    this.$.threshold.scrollTarget = appHeader.scrollTarget;
  }
}

insert into food (name, entity, alternative_id) select 'apple', ?, id from food where name = 'banana'; 是因为不清楚在这种情况下实体意味着什么。