Forums

This topic is locked

Access sql problem

Posted 03 Mar 2008 23:03:06
1
has voted
03 Mar 2008 23:03:06 Ryan Preece posted:
Hi all,

Not sure I'm in the right place with this but I'll give it a shot.

I've made a content manageable news sections for a site where some news stories have no pictures and some can have multiple.

I have 2 tables in access:
1. the news table containing data about the news
2. an image table whereby the picture data stored in here has a reference to the parent story.

i.e. news story 1 = [ID,News_title,news_date,news_bodycopy]

the image table with images relative is something like: [ID,ref_id,picture,caption] where ref_id is relative to the story id.

I then query in access which gives me a result of the story with the images relative.

the problem is obvious - In the query I get multiple rows of the same story with a different picture.

What I would like as a result is to filter this (remove the duplicates) for the main news page whereby it just shows the story and 1 relative picture.

I'm not great in access and I've built a forum before where I learned how to count results etc but what I would like to do is just get 1 story back with one picture.
I though that the duplicate wizard in access would be the solution but this removes all duplicates without leaving any trace of the story in the query!

Anyone know how I can get around this? am I going in the right direction?

All help would be much appreciated - even if its 'you built it the wrong way you silly boy!'

Best

Ryan

Reply to this topic