Avatar billede kjeldsted Novice
08. november 2008 - 20:56 Der er 4 kommentarer og
1 løsning

Hjælp til ORDER BY

Hej alle.

Hvordan får jeg følgende kode til at sortere efter runja_rundown.pos?

"SELECT runja_rundown.id_type AS type,runja_rundown.pos,runja_rundown.id_live,runja_live.type,runja_live.oplaeg AS oplaeg,runja_live.nedlaeg AS nedlaeg,runja_eng_sot.id AS id,runja_eng_sot.beskrivelse AS beskrivelse FROM runja_rundown INNER JOIN runja_live ON runja_rundown.id_live=runja_live.id INNER JOIN runja_eng_sot ON runja_eng_sot.id=runja_rundown.id_element WHERE runja_rundown.id_orders='$order_id' AND (runja_rundown.id_type='1' OR runja_rundown.id_type='2')
UNION ALL
SELECT runja_rundown.id_type AS type,runja_rundown.pos,runja_rundown.id_live,runja_live.type,runja_live.oplaeg AS oplaeg,runja_live.nedlaeg AS nedlaeg,runja_vo_tlg.id AS id,runja_vo_tlg.beskrivelse AS beskrivelse FROM runja_rundown INNER JOIN runja_live ON runja_rundown.id_live=runja_live.id INNER JOIN runja_vo_tlg ON runja_vo_tlg.id=runja_rundown.id_element WHERE runja_rundown.id_orders='$order_id' AND (runja_rundown.id_type='3' OR runja_rundown.id_type='4')
UNION ALL
SELECT runja_rundown.id_type AS type,runja_rundown.pos,runja_rundown.id_live,runja_live.type,runja_live.oplaeg AS oplaeg,runja_live.nedlaeg AS nedlaeg,runja_jin.id AS id,runja_jin.filnavn AS beskrivelse FROM runja_rundown INNER JOIN runja_live ON runja_rundown.id_live=runja_live.id INNER JOIN runja_jin ON runja_jin.id=runja_rundown.id_element WHERE runja_rundown.id_orders='$order_id' AND runja_rundown.id_type='6'"

På forhånd tak.
Avatar billede hmortensen Nybegynder
09. november 2008 - 00:25 #1
Kan du ikke blot sætte en order by på.

"SELECT runja_rundown.id_type AS type,runja_rundown.pos,runja_rundown.id_live,runja_live.type,runja_live.oplaeg AS oplaeg,runja_live.nedlaeg AS nedlaeg,runja_eng_sot.id AS id,runja_eng_sot.beskrivelse AS beskrivelse FROM runja_rundown INNER JOIN runja_live ON runja_rundown.id_live=runja_live.id INNER JOIN runja_eng_sot ON runja_eng_sot.id=runja_rundown.id_element WHERE runja_rundown.id_orders='$order_id' AND (runja_rundown.id_type='1' OR runja_rundown.id_type='2')
UNION ALL
SELECT runja_rundown.id_type AS type,runja_rundown.pos,runja_rundown.id_live,runja_live.type,runja_live.oplaeg AS oplaeg,runja_live.nedlaeg AS nedlaeg,runja_vo_tlg.id AS id,runja_vo_tlg.beskrivelse AS beskrivelse FROM runja_rundown INNER JOIN runja_live ON runja_rundown.id_live=runja_live.id INNER JOIN runja_vo_tlg ON runja_vo_tlg.id=runja_rundown.id_element WHERE runja_rundown.id_orders='$order_id' AND (runja_rundown.id_type='3' OR runja_rundown.id_type='4')
UNION ALL
SELECT runja_rundown.id_type AS type,runja_rundown.pos,runja_rundown.id_live,runja_live.type,runja_live.oplaeg AS oplaeg,runja_live.nedlaeg AS nedlaeg,runja_jin.id AS id,runja_jin.filnavn AS beskrivelse FROM runja_rundown INNER JOIN runja_live ON runja_rundown.id_live=runja_live.id INNER JOIN runja_jin ON runja_jin.id=runja_rundown.id_element WHERE runja_rundown.id_orders='$order_id' AND runja_rundown.id_type='6'
ORDER BY runja_rundown.pos"
Avatar billede kjeldsted Novice
09. november 2008 - 00:47 #2
Så får jeg bare

Unknown column 'runja_rundown.pos' in 'order clause'
Avatar billede hmortensen Nybegynder
09. november 2008 - 01:03 #3
Og hvis du blot skriver "ORDER BY pos", gør det nogen forskel?
Avatar billede kjeldsted Novice
09. november 2008 - 13:42 #4
Det virker sku :D

Mange, mange tak for hjælpen. Smid et svar...
Avatar billede hmortensen Nybegynder
09. november 2008 - 13:49 #5
Det var så lidt.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester