между первым приходом и последней реализацией посчитать дни у номенклатуры
По теме из базы знаний
- Выгрузка-загрузка любых данных из 1С (и измененных) в XML между похожими конфигурациями (ФАЙЛ, HTTP, COM) ЛЮБЫХ баз 1С 8.1-8.3 с обработкой и поиском данных по произвольным полям поиска
- Минимализмы 2
- УМП - Универсальный механизм планирования
- Конфигурация Flowcon: Набор инструментов для управления задачами, проектами и бизнесом в 1С
- CRM в облаках
Ответы
Подписаться на ответы
Инфостарт бот
Сортировка:
Древо развёрнутое
Свернуть все
I have tab1(date,name,qty) and tab2(date,name,qty) I need tab (name, number o days) where the number of days is the difference between last date from tab1 and last date from tab2
================================
You can use a combination of MAX and DATEDIFF functions to get the desired result. Here's an example of how you can do it:
SEL ECT t1.name, DATEDIFF(MAX(t1.date), MAX(t2.date)) as number_of_days
FROM tab1 t1
JOIN tab2 t2 ON t1.name = t2.name
GROUP BY t1.name
This will give you a result set with the name and the number_of_days for each name that appears in both tables. The number_of_days is calculated as the difference between the maximum date from tab1 and the maximum date fr om tab2 for each name.
Note that this will only work if both tables have at least one row for each name. If either table has a name that does not appear in the other table, it will not be included in the result set.
I hope this helps! Let me know if you have any questions or if you need further assistance.
================================
You can use a combination of MAX and DATEDIFF functions to get the desired result. Here's an example of how you can do it:
SEL ECT t1.name, DATEDIFF(MAX(t1.date), MAX(t2.date)) as number_of_days
FROM tab1 t1
JOIN tab2 t2 ON t1.name = t2.name
GROUP BY t1.name
This will give you a result set with the name and the number_of_days for each name that appears in both tables. The number_of_days is calculated as the difference between the maximum date from tab1 and the maximum date fr om tab2 for each name.
Note that this will only work if both tables have at least one row for each name. If either table has a name that does not appear in the other table, it will not be included in the result set.
I hope this helps! Let me know if you have any questions or if you need further assistance.
Для получения уведомлений об ответах подключите телеграм бот:
Инфостарт бот