Hey,

i have a table called users which has my users in it, each have a uid field.
I also have a stories table which has stories in it each with a sid field
for each story but also a uid field so i know which user the story belongs
to.

i want to write a query that will display the story depending on the user..
basically i guess it works like a word press blog. eg, Andrew logs into the
site and only his stories are displayed, but if john logs in, only his
stories are displayed.

Here are my tables

mysql> describe stories;
+-----------+-----------+------+-----+-------------------+----------------+
| Field     | Type      | Null | Key | Default           | Extra          |
+-----------+-----------+------+-----+-------------------+----------------+
| sid       | int(8)    | NO   | PRI | NULL              | auto_increment |
| uid       | int(8)    | NO   | MUL | NULL              |                |
| story     | text      | NO   |     | NULL              |                |
| storyDATE | timestamp | NO   |     | CURRENT_TIMESTAMP |                |
+-----------+-----------+------+-----+-------------------+----------------+
4 rows in set (0.02 sec)

mysql> describe users;
+-----------+-------------+------+-----+---------+----------------+
| Field     | Type        | Null | Key | Default | Extra          |
+-----------+-------------+------+-----+---------+----------------+
| uid       | int(8)      | NO   | PRI | NULL    | auto_increment |
| username  | varchar(12) | NO   |     | NULL    |                |
| password  | varchar(32) | NO   |     | NULL    |                |
| firstName | varchar(15) | NO   |     | NULL    |                |
| lastName  | varchar(15) | NO   |     | NULL    |                |
+-----------+-------------+------+-----+---------+----------------+
5 rows in set (0.01 sec)




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to