Jump to content

Need help forming a SELECT query


xcasio

Recommended Posts

Hi,

 

I need some help on a SELECT query. This is my table structure with only relevant fields:

 

Table #1: interiors

id (int)

MapIconID (int)

 

Table #2: properties

id (int)

IntID (int)

 

What I want to accomplish is selecting all of the rows in properties, getting the MapIconID from the interiors table by using the IntID field.

 

I'm not really good at explaining and it might sound confusing, so here's how it should work:

* Select all the fields from properties

* Find the `IntID` of each field and match it up with the corresponding id in the `interiors` table

* Make a new column called `MapIconID` and display it

 

Okay, I still think this sounds confusing - one more example.

 

Example of `interiors`:

Row 1: id:20, MapIconID:506

Row 2: id:21, MapIconID:149

 

Example of `properties`:

Row 1: id:55, IntID:20

Row 2: id:56, IntID:0

 

What the result should be after selecting `properties`

Row 1: id:55, IntID:20, MapIconID:506

Row 2: id:56, IntID:0, MapIconID:0

 

Hopefully someone can help me!

 

Thank you kindly for your help.

Link to comment
https://forums.phpfreaks.com/topic/187143-need-help-forming-a-select-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.