sql

sql

Naming SQL tables in a subquery

Question: If we re-access the table from the main query, we consider it "from scratch" or in a version truncated by the conditions from the main question. For instance: SELECT DISTINCT IDX1.<столбец_1> FROM <таблица_1> IDX1 INNER JOIN <таблица_2> IDX2 ON IDX1.<столбец_n> = IDX2.<столбец_m> AND IDX2.<столбец_1> IN (<список>) WHERE NOT EXISTS …

Naming SQL tables in a subquery Read More »

Quantity by first date SQL

Question: SELECT store.odyid ,g.FID ,sds.QUANTITY ,min(convert(date,doc1.DOC_DATE)) as min_date FROM [store.move] AS m INNER JOIN [STORE.DOC] AS doc1 ON m.id_doc = doc1.ID_DOC INNER JOIN [store.move.spec] AS sm ON m.id_doc = sm.id_doc INNER JOIN [STORE.DOC.SPEC] AS sds ON sm.id_doc_spec = sds.ID_DOC_SPEC INNER JOIN artikul_full ON sm.id_artikul_new = artikul_full.ID_artikul INNER JOIN STORE ON …

Quantity by first date SQL Read More »

Scroll to Top
AllEscort