Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
MySQL problemčić

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
pozitron



Joined: 19 Oct 2008
Posts: 6
Location: Slavonsi Brod

PostPosted: 19.10.2008 17:03    Post subject: MySQL problemčić Add user to your forum ignore list Reply with quote

I have situation Smile

imamo jednu tablicu - zove se 'knjiga'.
Ona ima 2 polja: IDzapis (int) i IDpod_zapis(int)

Primjer:

|_IDzapis_|_IDpod_zapis_|
|_600____|__1_________|
|_600____|__2_________|
|_600____|__3_________|
|_601____|__1_________|

PROBLEM I PITANJE:

Svaki IDzapis ima n broj IDpod_zapisa. Ne smije mi se dogoditi dupliciranje. Ni u jednu od kolona ne smijem staviti Unique postavku.

Moje pitanje: Mogu li te dvije kolone biti jedna UNIQUE cjelina? Dakle kombiacija IDzapis i IDpod_zapis je UNIKATNA i ne može se duplicirati.
Back to top
View user's profile Send private message
PaNtHeR



Joined: 17 Sep 2003
Posts: 161

PostPosted: 19.10.2008 17:21    Post subject: Add user to your forum ignore list Reply with quote

Iako to nikad nisam koristio, mislim da je moguće ovako:

prilikom kreiranja tablice:
UNIQUE KEY `knjiga_unique_key` (`ID_zapis`, `ID_pod_zapis`)

ili poslije:
ALTER TABLE `knjiga` ADD UNIQUE (`ID_zapis` ,`ID_pod_zapis`);

_________________
Back to top
View user's profile Send private message Send e-mail
pozitron



Joined: 19 Oct 2008
Posts: 6
Location: Slavonsi Brod

PostPosted: 19.10.2008 18:02    Post subject: Add user to your forum ignore list Reply with quote

PaNtHeR je stvarno PaNtHeR Smile

Hvala, Puuuno Hvalaa.

Probao sam, sve radi... Dvije kolone su postale jedna unikatna kolona.



PROBLEM RIJEŠEN
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group