Jump to content

Sql Queries Question - Multiple Tables


Recommended Posts

Alright Im going to do my best to explain my situation in a simple manner.2 tables. One table is to display content and the second table establishes an image to display depending on the name of the content. So here we havetable1.name, table2.imageTable 1 and table 2 also share a column in common:table1.points, table2.pointsWhat I want to display is table1.name and table2.image when table1.points = table2.points. Like, depending on how many 'points' is shown depends on the image shown. Let me set up something small for visualtable1Name PointsApple 1Banana 2Chestnut 1Donut 2So as you can see the amount of points can duplicate.table2Image Points1Point 12Point 2The points are only in there once, to match with the image.So say I want to display the table like:Apple 1 1PointBanana 2 2PointChestnut 1 1PointDonut 2 2PointSee how depending on how many points the name has, depends on the 'image' that shows up.*Note* No images are used in the database, just a string of text. All fields are varchar or int/tinyint. Just dont want to make things confusing, nothing special.So, whats the best way to do this? :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...