Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I'm so glad I found this site... Now I can get some sleep, because my problem is solved..."

Geography

Where in the world do Tek-Tips members come from?
shop73 (IS/IT--Management)
25 Nov 09 19:04
Hello everyone,

I made two pages (Search and Result). I've created a database with five tables (cities, categories, images, photographers and years). I used two parameters from search page (categoryID and photographerID). On the results page, I made the following query:

CODE

SELECT cities.cityID, cities.cityName, categories.categoryID, categories.categoryName, photographer.photographerID, photographer.photographerName, cities.description, years.yearName, images.imageID, images.imageName, images.imagePath
FROM cities, categories, phofographers, years, images
WHERE cities.categoryID = categories.categoryID AND cities.photographerID = photographers.photographerID AND cities.yearID = years.yearID AND categories.categoryID = colname1 AND photographers.photographerID = colname AND images.cityID=cities.cityID AND images.imageID IN (SELECT MIN(imageID) as tmp FROM images
GROUP BY cityID)
ORDER BY cities.cityName ASC

colname = colname, numeric, -1, $_GET['photographer']
colname1= colname1,numeric, -1, $_GET['category']

Table cities
------------
cityID
cityName
cityYear
cityShow - Y - N

Table photographers
-------------------
photographerID
photographerName

Table categories
----------------
categoryID
categoryName (major city, city)

Table years
-----------
yearID
yearName

Table images
------------
imageID
imageName
imagePath
cityID

I wanted to get, depending on the url parameter, results that will show all cities (major cities or cities from certain photographers) and only one image for the city. Each photographers can have multiple pictures of the same city but i need to show only one image from multiple pictures on the master page. On the detail page I will to show all the images.

This query is wrong!Does not show all cities on the result page. Can You help me?

Best regards    

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close