Koristim IB.
Imam 3 tabele sa sledecom strukturom:
tabela1 [ID,NAZIV]
tabela2 [IDU,IDS1,IDS2,IDS3]
tabela3 [IDU]
Potrebno je da dobijem podatke u sledecoj formi:
tabela1.ID, tabela1.NAZIV gde je tabela1.ID=tabela2.IDS1
tabela1.ID, tabela1.NAZIV gde je tabela1.ID=tabela2.IDS2
tabela1.ID, tabela1.NAZIV gde je tabela1.ID=tabela2.IDS3
i tako u tri reda.
Ovo sve dobijam sa SQL-om (deo and p.idu='100' mi sluzi samo za proveru)
select t.id, t.naziv from tabela1 t
where t.id in (select s.ids1 from tabela2 s, tabela3 p where s.idu=p.idu and p.idu='100')
or t.id in (select s.ids2 from tabela2 s, tabela3 p where s.idu=p.idu and p.idu='100')
or t.id in (select s.ids3 from tabela2 s, tabela3 p where s.idu=p.idu and p.idu='100')
Problem je sto meni trebaju podaci sortirani redom po redosledu polja IDS1, IDS2, IDS3
Ja dobijem validne podatke, ali mi se podaci, te tri kolone sortiraju po ID od manjeg ka vecem.
Kako da sortiram podatke po redosledu IDS1, IDS2, IDS3?
Hvala