You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mappedResultsQuery should be mapped to table Alias instead table Name, when has an alias.
Now, this works. But it ignores the alias on the table:
List<Map<String, Map<String, dynamic>>> results = await connection.mappedResultsQuery(
"SELECT t_alias.id, t_alias.name, u_alias.name FROM t t_alias
LEFT OUTER JOIN u u_alias ON t.id=u.t_id");
for (final row in results) {
var tID = row["t"]["id"];
var tName = row["t"]["name"];
var uName = row["u"]["name"];
}
But the correct way should be with alias:
for (final row in results) {
var tID = row["t_alias"]["id"];
var tName = row["t_alias"]["name"];
var uName = row["u_alias"]["name"];
}
Column name x alias is working correctly. When it has an alias in column, the mappedResultsQuery returns the alias instead column name.
The text was updated successfully, but these errors were encountered:
supermuka
changed the title
mappedResultsQuery map table Alias instead table Name
mappedResultsQuery should be mapped to table Alias instead table Name
Jun 30, 2020
With this query we have problems. But it should work correctly with results below:
List<Map<String, Map<String, dynamic>>> results = await connection.mappedResultsQuery(
"SELECT t_alias.id, t_alias.name, u_alias.name, u_two_alias.name FROM t t_alias
LEFT OUTER JOIN u u_alias ON t_alias.id=u_alias.t_id
LEFT OUTER JOIN u u_two_alias ON t_alias.id_two=u_tow_alias.t_id");
for (final row in results) {
var tID = row["t_alias"]["id"];
var tName = row["t_alias"]["name"];
var uName = row["u_alias"]["name"];
var uTwoName = row["u_two_alias"]["name"];
}
mappedResultsQuery should be mapped to table Alias instead table Name, when has an alias.
Now, this works. But it ignores the alias on the table:
But the correct way should be with alias:
Column name x alias is working correctly. When it has an alias in column, the mappedResultsQuery returns the alias instead column name.
The text was updated successfully, but these errors were encountered: