Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with select left join from field columns #161

Closed
azhai2016 opened this issue Aug 7, 2019 · 1 comment
Closed

Issue with select left join from field columns #161

azhai2016 opened this issue Aug 7, 2019 · 1 comment
Labels
bug

Comments

@azhai2016
Copy link

@azhai2016 azhai2016 commented Aug 7, 2019

nSQL().createDatabase({
id: "my-db",
mode: "TEMP", // pass in "PERM" to switch to persistent storage mode!
tables: [
{
name: "users",
model: {
// pk == primary key, ai == auto incriment,
"id:int": {pk: true, ai: true},
"name:string": {},
"age:int":{}
}
},
{
name: "users1",
model: {
// pk == primary key, ai == auto incriment,
"id:int": {pk: true, ai: true},
"name:string": {},
"age:int":{}
}
},
]
})
.then(function() {
// Add a record
nSQL("users1").query('upsert',{
name:"aaa", age: 10
}).exec();

return nSQL("users").query('upsert',{
    name:"aaa", age: 20
}).exec();

})
.then(function(result) {
// select all rows
return nSQL()
.query('select',["users1.name AS aaa"])
.join({
type:"left",
with:{table:"users1"},
on:["users.name","=","users1.name"]
}).exec();
})
.then(function(result) {
var elem = document.createElement("pre");
document.body.appendChild(elem);
elem.innerHTML = JSON.stringify(result, null, 4)
})

result:
[
{
"aaa.0": "a",
"aaa.1": "a",
"aaa.2": "a"
}
]

@azhai2016 azhai2016 changed the title Join select from columns issue Issue with select left Join from columns Aug 7, 2019
@azhai2016 azhai2016 changed the title Issue with select left Join from columns Issue with select left join from columns Aug 7, 2019
@azhai2016 azhai2016 changed the title Issue with select left join from columns Issue with select left join from field columns Aug 7, 2019
@ClickSimply ClickSimply added the bug label Aug 8, 2019
ClickSimply pushed a commit that referenced this issue Aug 12, 2019
@ClickSimply

This comment has been minimized.

Copy link
Owner

@ClickSimply ClickSimply commented Aug 12, 2019

This has been resolved in 2.3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.