Good Morning,
I'm attempting to write a single SQL statement that will accomplish the following...
[code=txt]
table_a
PK INT table_a_id
VARCHAR ref_num
table_b
PK INT table_b_id
FK INT table_a_id
DATETIME insert_date
VARCHAR note
[/code]
This is a sample of a single row I want to pull from the data...
The major thing I want to accomplish is having a.ref_num appear only once and loop through the notes to appear as a single row.
I currently am using two arrays within PHP to handle the construction of this, but I feel like it is losing efficiency if it can be done within the SQL syntax.
Any help would be appreciated.
Thanks!
I'm attempting to write a single SQL statement that will accomplish the following...
[code=txt]
table_a
PK INT table_a_id
VARCHAR ref_num
table_b
PK INT table_b_id
FK INT table_a_id
DATETIME insert_date
VARCHAR note
[/code]
This is a sample of a single row I want to pull from the data...
Code:
a.ref_num b.note
0001 Note1
Note2
Note3
I currently am using two arrays within PHP to handle the construction of this, but I feel like it is losing efficiency if it can be done within the SQL syntax.
Any help would be appreciated.
Thanks!
Comment