Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Łączenie 2 Tablic i Sortowanie
Kwadrat
post
Post #1





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 21.04.2003

Ostrzeżenie: (0%)
-----


Mam przykladowo 2 tabele:

Tabel nr. 1 : tabela_1
  1. id | tekst | nr | czas ------------------------
  2. 0 | ble0 | 1 | 2005.03.01 15:00
  3. 1 | ble1 | 1 | 2005.03.02 15:00
  4. 2 | ble2 | 1 | 2005.03.03 15:00
  5. 3 | ble3 | 1 | 2005.03.04 15:00

Tabel nr. 2 : tabela_2
  1. id | tekst | nr | czas ------------------------
  2. 5 | ble0 | 2 | 2005.03.01 17:00
  3. 6 | ble1 | 2 | 2005.03.02 17:00
  4. 7 | ble2 | 2 | 2005.03.03 17:00
  5. 8 | ble3 | 2 | 2005.03.04 17:00

I chce zeby mi to polaczyl w jedna tabele i posegergowal razem wedlug "czas" oczywiscie dzialajac w petli czyli:

Tabel:
  1. id | tekst | nr | czas ------------------------
  2. 8 | ble3 | 2 | 2005.03.04 17:00
  3. 3 | ble3 | 1 | 2005.03.04 15:00
  4. 7 | ble2 | 2 | 2005.03.03 17:00
  5. 2 | ble2 | 1 | 2005.03.03 15:00
  6. 6 | ble1 | 2 | 2005.03.02 17:00
  7. 1 | ble1 | 1 | 2005.03.02 15:00
  8. 5 | ble0 | 2 | 2005.03.01 17:00
  9. 0 | ble0 | 1 | 2005.03.01 15:00


zrobilem cos takiego co mi wyciag dane z obu tablei w jednym zapytaniu ale cos nie chce sortowac. Dodalem tam miezy innymi "ORDER BY tabela_1.czas AND tabela_2.czas" ale nic nie dalo ;]. Wogole probowalem na wiele spospobow ale nic nie dziala (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) I jak narazie jestem w kropce (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

  1. SELECT
  2. tabela_1.id,
  3. tabela_1.tekst,
  4. tabela_1.nr,
  5. tabela_1.czas,
  6. tabela_2.id,
  7. tabela_2.tekst,
  8. tabela_2.nr,
  9. tabela_3.czas,
  10. FROM tabela_1, tabela_2
  11. DESC


ThX

Ten post edytował Kwadrat 9.03.2005, 15:49:08
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 15.09.2025 - 03:07