cuadrantes-espiral
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cuadrantes-espiral] Mensajes foros


From: Diego Arranz
Subject: [Cuadrantes-espiral] Mensajes foros
Date: Sat, 29 Jun 2002 18:39:56 +0200

Javier, no es un esquema, pero creo que te
puede servir para depurar esa consulta que
tiene que sacar el usuario que ha enviado
el último mensaje:

CREATE TABLE topics (
  topic_id int(10) NOT NULL auto_increment,
  topic_title varchar(100) default NULL,
  topic_poster int(10) default NULL,
    ...
    ...
  KEY topic_last_post_id (topic_last_post_id)   <----
)

CREATE TABLE posts (
  post_id int(10) NOT NULL auto_increment,
  topic_id int(10) NOT NULL default '0',
    ...
    ...
  KEY poster_id (poster_id)  <----
)

CREATE TABLE users (
  user_id int(10) NOT NULL auto_increment,
  username varchar(40) NOT NULL default '',
    ...
    ...
)


O sea, el campo "topic_last_post_id" de topics te da
el último post, "poster_id" te da el usuario, y se
imprime su "username".

Unos cuantos JOINS con estos campos y listo, ¿no?

Diego




reply via email to

[Prev in Thread] Current Thread [Next in Thread]