Jump to content

Cannot Use "LEFT JOIN" In Query DB Using Dynamic Tables


Dan_Mason

Recommended Posts

Hello All!

 

I am having trouble working this one out.

 

I am retrieving a data set from a Database which I want to look like this:

 

Column 1

Column 2

1

NULL

2

4

3

NULL

4

5

 

Instead it is being returned like this:

 

Column 1

Column 2

1

4

2

5

3

[/td]

4

[td]

 

As you can see, this would not be a constant data set, so when being put in an matrix, wrong data is matched.

 

Bearing in mind I am also using Dynamic Tables (Item Name, Item Value) which are constantly being updated.

 

I have tried using a LEFT JOIN Statement, but it does not work, I am still getting incorrectly matched data back from the query.

 

Here is the query:

 

$result = mysql_query=(
                        "SELECT $TableName.SectionIdent, ItemValue * 3.2808 
                         FROM $TableName
                         INNER JOIN $TableName2 
                         ON $TableName.SectionIdent=$TableName2.SectionIdent 
                         WHERE $TableName.SectionIdent 
                         IN( $strNumbers ) 
                         AND ItemName = $ItemName 
                         ORDER BY StartTime"
                       );

 

Any Suggestions as to a certain JOIN Type that could be used?

 

Cheers!

 

Dan  :)

Okay,

 

Let me re-phrase the question.

 

Can you use an LEFT JOIN to retrieve a constant data set (As I've shown pretty clearly above) from a Dynamic Table in a MySQL Database?

 

Thats pretty much all I want to know.

 

Sorry for the inconvenience.

 

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.