Built a query in wappler for sqlite db that has two tables. Products and categories. Products has a category field and the query ties them to together on a left join. Below is a screenshot from wappler query result vs Db Browser. DB Browser returns what I would expect, wappler does not with results that have blank fields that are not blank in the DB.
Query:
select `products`.`id`, `products`.`name`, `products`.`descrip`, `products`.`category`, `products`.`modifier`, `products`.`price`, `categories`.`id`, `categories`.`name`, `categories`.`price`, `categories`.`descrip` from `products` left join `categories` on `categories`.`id` = `products`.`id` order by `products`.`category` ASC, `products`.`name` ASC
this definitely a wappler problem. changed to mariadb docker, recreated the tables. recreated the api action with query. same result. however running the same query in mysql cli returns the correct data. see screen shot.
My join was incorrect but it still doesn’t explain why the two different results between wappler and the db browser app. I have my query working as expected but the behavior was odd.
I don't think the result is wrong, the problem I see is that you output columns with the same name from both tables. The DB Browser app probably shows those duplicate folders while in Wappler when a column has the same name it overwrites the previous one. Small update to the query should fix it:
select `products`.`id`, `products`.`name`, `products`.`descrip`, `products`.`category`, `products`.`modifier`, `products`.`price`, `categories`.`id` as categoryId, `categories`.`name` as categoryName, `categories`.`price` as categoryPrice, `categories`.`descrip` as categoryDescrip from `products` left join `categories` on `categories`.`id` = `products`.`id` order by `products`.`category` ASC, `products`.`name` ASC