Skip to:
Content
Pages
Categories
Search
Top
Bottom

mySql querry help


  • shaunik
    Participant

    @shaunik

    Can someone suggest the best sql query to get table with user names, user emails, XProfile field and values. I am trying to create table with these values for user using plugin wpDataTable Constructor

    SELECT wp_bp_xprofile_data.value,
           wp_users.user_email,
           wp_users.display_name
    FROM wp_users
      LEFT JOIN wp_bp_xprofile_data
         ON wp_bp_xprofile_data.user_id = wp_user.ID
      LEFT JOIN wp_bp_xprofile_data
         ON wp_bp_xprofile_fields.id = wp_bp_xprofile_data.field_id
Viewing 3 replies - 1 through 3 (of 3 total)

  • danbp
    Moderator

    @danbp

    Hi,
    query seems to be correct, but you probably have to read through your plugin doc & tutorials:

    Creating new wpDataTables with Table Constructor

    … and, please, use the code button when you enter code on the forum.


    shanebp
    Moderator

    @shanebp

    Why not use an existing function like bp_core_get_users() ?


    shaunik
    Participant

    @shaunik

    @danbp: not sure why not working it comes with error

    MySQL said: Not unique table/alias: 'wp_bp_xprofile_data'
    

    Tried query in phpmyadmin, same error:

    
    SELECT wp_bp_xprofile_data.value,
           wp_users.user_email,
           wp_users.display_name
    FROM wp_users
      LEFT JOIN wp_bp_xprofile_data
         ON wp_bp_xprofile_data.user_id = wp_user.ID
      LEFT JOIN wp_bp_xprofile_data
         ON wp_bp_xprofile_fields.id = wp_bp_xprofile_data.field_id
     LIMIT 0, 30 
    MySQL said: Documentation
    #1066 - Not unique table/alias: 'wp_bp_xprofile_data'

    @shanebp: I wish wpdatatables allow php functions … it does’t

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘mySql querry help’ is closed to new replies.
Skip to toolbar