Topic: Why one Query works in mvd but not in SqliteStudio?

This query works in MVD.

@derek

select total(quantity) from transactions where transactions.id_products = products.id and quantity > 0
why no joins?

tables join auto in MVD so you guys write only some sql
if so
how I know which joins or pre provided query in MVD?

[17:25:06] Error while executing SQL query on database 'sqlite0': no such column: products.id

So I was learning sql - found join with group by

This works in SqliteStudio

SELECT products.id, products.name, SUM(transactions.quantity) AS total_quantity
FROM transactions
JOIN products ON transactions.id_products = products.id
WHERE transactions.quantity > 0
GROUP BY products.id, products.name;

Explain why?

2 (edited by k245 2024-05-16 12:32:58)

Re: Why one Query works in mvd but not in SqliteStudio?

If you use SQL then nothing is automatically attached  in MVD.
But if you write a query for a calculated field, then it is executed in the context of the main table query.

Визуальное программирование: блог и телеграм-канал.

Re: Why one Query works in mvd but not in SqliteStudio?

The first query is actually a simplified form of an inner join https://www.techonthenet.com/sqlite/joins.php.

If you get an error because there is no select total() function, you have to create the alias total_quantity as per the second query in your message.

https://www.sqlite.org/lang_select.html

Re: Why one Query works in mvd but not in SqliteStudio?

@k245

Do you have English version of your projects?

Re: Why one Query works in mvd but not in SqliteStudio?

kavinacomputers wrote:

@k245

Do you have English version of your projects?

I have a module for localizing applications, I use it when I need to create applications in several languages. The ClassExplorer application is an example of using this module.

https://k245.ru/wp-content/uploads/2023/04/vybor-yazyka.png

https://k245.ru/en/mvdb-en/resources-an … ation.html

Визуальное программирование: блог и телеграм-канал.