I'm working od a Poll
In first table I have a question ID and question itself (text) in second table I have answerID, question ID , answer itself (text) and votes
CREATE TABLE question (
id_question INT UNSIGNED NOT NULL auto_increment,
text VARCHAR(255) NOT NULL,
PRIMARY KEY (id_vprasanje)
);
CREATE TABLE answer (
id_answr INT UNSIGNED NOT NULL auto_increment,
id_question INT UNSIGNED NOT NULL,
text VARCHAR (255) NOT NULL,
votes INT UNSIGNED NOT NULL,
PRIMARY KEY(id_odgovor)
);
This enables me to have unlimited number answers per question.
How can I select last question and answers? Can this be done in one step?
I hope you have an idea what I was trying to tell here.
Thanx
Blaz
In first table I have a question ID and question itself (text) in second table I have answerID, question ID , answer itself (text) and votes
CREATE TABLE question (
id_question INT UNSIGNED NOT NULL auto_increment,
text VARCHAR(255) NOT NULL,
PRIMARY KEY (id_vprasanje)
);
CREATE TABLE answer (
id_answr INT UNSIGNED NOT NULL auto_increment,
id_question INT UNSIGNED NOT NULL,
text VARCHAR (255) NOT NULL,
votes INT UNSIGNED NOT NULL,
PRIMARY KEY(id_odgovor)
);
This enables me to have unlimited number answers per question.
How can I select last question and answers? Can this be done in one step?
I hope you have an idea what I was trying to tell here.
Thanx
Blaz