Last active
April 18, 2018 09:25
-
-
Save vordan/6915a18222c93c9847ec254f2d7fd7ba to your computer and use it in GitHub Desktop.
Bara posledna cena za artikal vo tabela so ceni po datumi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- ------------------------------------------------------------------ | |
| -- Bara posledna cena za artikal vo tabela so ceni po datumi | |
| -- ------------------------------------------------------------------ | |
| select | |
| temp_promet.* | |
| from temp_promet | |
| inner join ( | |
| select | |
| artikal_id as artikal_id, | |
| max(datum_ddo) as max_datum_ddo, | |
| max(sifra) as max_sifra | |
| from temp_promet | |
| group by artikal_id | |
| ) as temp_promet_ceni on temp_promet_ceni.artikal_id = temp_promet.artikal_id and | |
| temp_promet_ceni.max_datum_ddo = temp_promet.datum_ddo and | |
| temp_promet_ceni.max_sifra = temp_promet.sifra | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment