如何获取与另一个表中存储的用户名关联的ID

时间:2018-06-25 14:47:13

标签: mysql

我正在尝试将数据从旧表复制到下面在MYSQL中列出的新表中

test.adminpasswordreset(正在插入的表)

TOKEN(VARCHAR)   ADMINID(INT)   TIMEIN   ISUSED

在重置密码时需要从ID表中提取user中的adminid

test.userprofile

ID(INT)     USERNAME(VARCHAR)

userprofile

中选择ID的正确查询是什么?

1 个答案:

答案 0 :(得分:0)

function delay(input) {
    return new Promise(function(resolve, reject) {
        // some async operation here
        setTimeout(function() {
            // resolve the promise with some value
            resolve(input + 10);
        }, 500);
    });
}

**async** function testing() { // Declare this an asynchronous function
    let value = **await** delay(5); // Now you can await the resolution of the Promise
    console.log(value); // Outputs resolved value 15!
    return value; // Just returns resolved Promise
}

var test = testing();

console.log(test); 
/** Outputs the Promise!
   Promise {<pending>}
     __proto__:Promise
     [[PromiseStatus]]:"resolved"
     [[PromiseValue]]:15
*/

test.then(console.log)); // Outputs returned resolved value, 15