List Info

Thread: Database help




Database help
user name
2007-03-09 16:15:37
I have a story with the URI '/advice/ask/2007/03/07/trash/'
and id
'25746'.

The id in the category table for '/advice/ask/' is '1031'.

But both of the following selects return a category__id of
'1030' (for
'/news/daily/') in table story__category:

SELECT * FROM story__category WHERE id = '25746';
SELECT * FROM story__category WHERE story_instance__id =
'25746';

What am I missing? (Keep in mind I'm relatively new to
working with the
database directly.)

Chris

-------------

Chris Schults
Web Production Manager
Grist
710 Second Avenue, Suite 860
Seattle, WA  98104
Phone: 206-876-2020, ext. 204
Fax: 253-423-6487
<http://www.grist.org>



Re: Database help
user name
2007-03-09 17:00:39
On Mar 9, 2007, at 14:15, Chris Schults wrote:

> SELECT * FROM story__category WHERE id = '25746';
> SELECT * FROM story__category WHERE story_instance__id
= '25746';
>
> What am I missing? (Keep in mind I'm relatively new to
working with  
> the
> database directly.)

You need to use the ID from the story_instance table for
that story.  
Try something like:


   SELECT max(id) FROM story_instance where story__id =
25746;

Then run the query with that ID.

Best,

David

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )