SQL to Develop Simple Report

carino

Member
Greetings All,

I am not SQL savvy and hoping someone here might be able to help.

I have a basic discussion forum online. The database is the default and the db name is "bisel_cc_community".

I have all the default fields that XF ships with that I am attempting to build SQL for ...
  1. username
  2. user_id
  3. email
and I have added two additional user fields to merge into the query
  1. relationship
  2. lotnum

I am hoping someone can help me build a SQL DB query that will create an output listing all the users and also include the two additional user field (relationship and lotnum).

From my mousing around in phpMyAdmin ... it looks like there are two tables that I need to concern myself with field values that I would want a query to generate for me ...
  1. Table, "xf_user" ... contains the field values for user_id, username and email
  2. Table, "sf_user_field_value" ... contains the field values for user_id, name, relationship and lotnum
I have been trying to create the SQL using phpMyAdmin, but no success and hoping someone might help.

Thanks,

Steve
 
I thought I would add this comment.

The two fields in xf_user table are highlighted in yellow

There are seven fields in xf_user_field_value that are highlighted in green

I need some help in joining these two tables together in a SQL statement so that I can run a query with an output going to a text file or a CSV file so that I can work with MS Excel.

Any help is appreciated ...

1614815386454.webp
 
I am hoping someone can help me build a SQL DB query that will create an output listing all the users and also include the two additional user field (relationship and lotnum).
There are seven fields in xf_user_field_value that are highlighted in green
This will get you going ...
SQL:
select xf_user.user_id, username, email, field_id, field_value
from xf_user
left join xf_user_field_value
on xf_user.user_id = xf_user_field_value.user_id;
 
Top Bottom