Jump to content

sql and php help


pagegen

Recommended Posts

Hi Guys, sorry for the title, didnt really know what to call this

 

here is the issue

 

I have a table, which stores relational data.. as you can see below, there are 2 rows in the database, which have the same event_id, I need to read them rows as 1 event

 

 

 

id | event_id | team_id 

1745485 | 186674438  | 11  | 1  | 0

1745486 | 186674438  | 13  | 2  | 0

 

the simple words are, I need to join the above 2 rows and make 1 row out of them but only when am echo to the screen so the end result is

id | event_id | team_id | team_id2

1745485 | 186674438  | 11  | 13  | 0

 

hope that makes sence

 

 

current sql

"SELECT bb_Event.*,
													 bb_EventParticipantRelation.id AS bb_EventParticipantRelation_id, bb_EventParticipantRelation.eventId, bb_EventParticipantRelation.eventPartId, bb_EventParticipantRelation.participantId, bb_EventParticipantRelation.participantRoleId, bb_EventParticipantRelation.parentParticipantId

													 FROM bb_Event, bb_EventParticipantRelation

													 WHERE 	bb_Event.parentId='".$g_league_type."' AND
													 		bb_Event.id = bb_EventParticipantRelation.eventId AND 
															bb_EventParticipantRelation.parentParticipantId = '0'

															"

 

thank you

Link to comment
https://forums.phpfreaks.com/topic/210941-sql-and-php-help/
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.