close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Too many results returned once I add another table

Thread began 6/07/2011 4:33 pm by Jared Lui | Last modified 6/15/2011 11:34 am by Jared Lui | 1688 views | 18 replies

Jared Lui

Too many results returned once I add another table

Currently on my results page when I leave the search fields blank it returns every row in my LINE table which it should. Right now there are only three rows and it returns all three. The search works for the other fields so there is no problem here.

Now, I have a second table of pictures that belong to the LINE table connected by a LINE_ID. There could be many pictures for each LINE so I went this route instead of just adding a picture column in the LINE table. Make sense?

My problem is that when I add the table and column to my query, instead of returning only three results with the pictures linked, I get 15 results returned. I have 5 rows currently in my PICTURES table, so it returns 5 rows for every LINE returned. Likewise, if I narrow the search so only one result should return. I get 5 results using the second query while using the original query the one proper result displays.

--------------------------
Here is the original query that works correctly but doesn't contain the table/column needed to display my images. This returns all results as I would expect.

SELECT Line_Id, Line_Name, Line_Nickname, Start_Decade, End_Decade, Manufacturer, Size, Cat_1, Cat_2, Cat_3, Approved, Locked, Added_By, Line_Text
FROM figure_lines
ORDER BY Line_Name DESC
--------------------------
--------------------------
Here is my modified query that gives my recordset the binding I need for the pictures. This returns all the results the above query does plus everything that has a Filename. Which I get, but I do not know how to go about being able to get the bindings for the pictures another way. I've tried messing with the WHERE statement and variables a bit to no avail.

SELECT figure_lines.Line_Id, Line_Name, Line_Nickname, Start_Decade, End_Decade, Manufacturer, Size, Cat_1, Cat_2, Cat_3, figure_lines.Approved, Locked, figure_lines.Added_By, Line_Text, picture.Filename
FROM figure_lines, picture
ORDER BY Line_Name DESC
--------------------------

I'd also like to be able to only have the picture row returned that has the thumbnail column marked. All suggestions are welcome. Thanks in advance.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...