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  :)

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.