Jump to content

[SOLVED] joining table twice?


delphi123

Recommended Posts

Hi folks,

 

Am really struggling with this one, I've got a single table (out of my control unfortunately) which has data stored in it, two fields I need are site url and site description, these are identified by their ids of 18 and 19 respectively as you can see in this screenshot:

23852346.jpg

 

 

 

Now I'm trying to join these values as new columns to another table, but it's just not working I can get one working fine, just not both, can anyone help?

 

SELECT

urldb.data_txt,

descdb.data_txt,

jos_sobi2_item.title

FROM

jos_sobi2_fields_data AS urldb ON urldb.fieldid = 18

Inner Join jos_sobi2_fields_data AS descdb ON descdb.itemid = urldb.itemid AND urldb.fieldid = 19

Inner Join jos_sobi2_item ON urldb.itemid = jos_sobi2_item.itemid

Link to comment
Share on other sites

SELECT
urldb.data_txt,
descdb.data_txt,
jos_sobi2_item.title
FROM
jos_sobi2_fields_data AS urldb
INNER JOIN
jos_sobi2_fields_data AS descdb
ON descdb.itemid = urldb.itemid AND descdb.fieldid = 19 AND urldb.fieldid = 18
INNER JOIN
jos_sobi2_item 
ON urldb.itemid = jos_sobi2_item.itemid

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.