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
https://forums.phpfreaks.com/topic/179736-solved-joining-table-twice/
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

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.