Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z tabelą
Bastion
post
Post #1





Grupa: Zarejestrowani
Postów: 505
Pomógł: 0
Dołączył: 8.01.2005

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


mam taka tabele :

Kod
a_id INT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
a_name VARCHAR(128) NOT NULL DEFAULT '',
b_id INT(8) UNSIGNED NOT NULL
b_name VARCHAR(128) NOT NULL DEFAULT '',
PRIMARY KEY (a_id),
UNIQUE KEY a_name (a_name)


jak zaoperowac b_id i b_name aby b_id tez bylo primary, a b_name mialo atrybut unique w taki sposob aby dalo sie wprowadzic takie dane :

INSERT INTO tabela SET (a_id, a_name, b_id, b_name) VALUES (1, "aaa", 1, "aaa")
INSERT INTO tabela SET (a_id, a_name, b_id, b_name) VALUES (2, "bbb", 1, "aaa")

ale juz

INSERT INTO tabela SET (a_id, a_name, b_id, b_name) VALUES (2, "bbb", 2, "aaa")
nie ze wzgledu na uniqe b_name
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
SongoQ
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

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


No to tak jak pisalem zrob unikalny na 2 pola (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
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: 26.09.2025 - 22:02