Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Niewykonalne zapytanie ?
kpax81
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 19.01.2007
Skąd: Olsztyn

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


Siemanko
Mam male pytanko zwiazane z zapytaniem w mysqlu:)

Storzylem 3 tabele.

Ksiazki ( id_ksiazki int not null auto_increment,
tytul varchar(100));

Autorzy (id_autora int not null auto_increment,
imie varchar(10),
nazwisko varchar(30));

Relacje(id_ksiazki int unsigned not null,
id_autora int unsigned not null);


Ta trzecia tabelka po to jakby ksiazka maiala wiecej niz jedengo
autora.
Np ksiazka pt:"Kubus puchatek" autorzy: "Marcin Cyrankowski"
i "Stefek Burczymucha"

Wpisalem te nazawiska do tabeli auorzy i tytul do tabeli ksiazki a do
tabeli relacje wstawilem dwa rekordy do jednej ksiazki bo dwa nazwiska
np. tak
insert into relacje ('1','1'),('1','2'); pierwsz wartosc to
id_ksiazki druga atorow.

Zeby wyswietlic interesujace mnie informacje o ksiazce uzywam
polecenia:

select tytul,imie,nazwisko from ksiazki,autorzy, relacje where
relacje.id_ksiazki=ksiazki.id_ksiazki and
relacje.id_autora=autorzy.id_autora;
i wszysto ladnie dziala (IMG:http://forum.php.pl/style_emoticons/default/exclamation.gif) !!

Problem w tym ze jezeli mam dwoch autorow to te informacje
wyswietlane sa w dwoch rekordach.:
Kubus puchatek --- Marcin Cyrankowski
Kubus puchatek --- Stefek burczymuch i to mi sie wlasnie nie
podoba!!!

Bo robie stronke z ksiazkami i jak wrzuce na stronke kodzik php zeby
pobral informacje na temat ksiazek t owyswietla mi je w tylu
rekordach ilu ksiazka ma autorow (IMG:http://forum.php.pl/style_emoticons/default/exclamation.gif)
Jak to zmienic (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) ?
Zeby bylo wyswietlone Kubus puchatek -- Marcin
Cyrankowski, Stefek Burczymucha
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: 23.08.2025 - 16:21