---
title: "How to use MySQL functions in SQL macro"
canonical: "https://support.appfire.com/space/SUPPORT/89134181/How%20to%20use%20MySQL%20functions%20in%20SQL%20macro"
format: markdown
---
<span style="color: #333333">This article explains how to use the CONCAT, JOIN, LEFT functions of MySQL in the </span>*<span style="color: #333333">SQL for Confluence (Pro Edition) </span>*<span style="color: #333333">app</span><span style="color: #333333">.</span>

## <span style="color: #333333">Instructions</span>

<span style="color: #333333">Follow the steps:</span>

1. <span style="color: #333333">Log into the Confluence instance.</span>
2. <span style="color: #333333">Go to the required confluence page and edit the same.</span>
3. <span style="color: #333333">Insert a SQL macro and go to the </span>**<span style="color: #333333">Edit</span>**<span style="color: #333333"> option to open the macro editor.</span>  
> Macro (inline-media-image)
4. <span style="color: #333333">Select a </span>*<span style="color: #333333">Data source profile</span>*<span style="color: #333333"> and enter the required SQL query in </span>*<span style="color: #333333">SQL statement</span>*<span style="color: #333333">. Follow </span>[<span style="color: #333333">this link</span>](https://appfire.atlassian.net/wiki/spaces/SQL/pages/74321547/Configure+Data+Source+Profiles+-+10.x)<span style="color: #333333"> to configure </span>**<span style="color: #333333">Data source profile.</span>**
  - <span style="color: #333333">CONCAT () - This function allows you to add two or more strings together.</span>
    > Macro (inline-media-image)

  
<span style="color: #333333">Click </span>**<span style="color: #333333">Save settings</span>**<span style="color: #333333"> in the macro editor and </span>**<span style="color: #333333">Update </span>**<span style="color: #333333">to save the page edits.</span>  
> Macro (inline-media-image)
  - <span style="color: #333333">JOIN</span>**<span style="color: #333333"> - </span>**<span style="color: #333333">A JOIN clause is used to combine rows from two or more tables, based on column(s) common to both of them.</span>  
  
<span style="color: #333333">In this example, a join is used on two tables </span>*<span style="color: #333333">cwd_user</span>*<span style="color: #333333"> and </span>*<span style="color: #333333">cwd_group. </span>*<span style="color: #333333">The result is displayed based on the common columns in both the tables.</span>
    > Macro (inline-media-image)

  
<span style="color: #333333">  </span><span style="color: #333333">Click </span>**<span style="color: #333333">Save settings</span>**<span style="color: #333333"> in the macro editor and </span>**<span style="color: #333333">Update </span>**<span style="color: #333333">to save the page edits.</span>  
> Macro (inline-media-image)
  - <span style="color: #333333">LEFT () - This function is a string function that returns the left part of a string with a specified length. </span>  
<span style="color: #333333">In this example, the statement uses the </span>`LEFT `<span style="color: #333333">function to return the 10 leftmost characters of the string </span>`group_name`<span style="color: #333333">. The long group_name can be displayed in a short form if required.</span>
    <span style="color: #333333">Click </span>**<span style="color: #333333">Save settings</span>**<span style="color: #333333"> in the macro editor and </span>**<span style="color: #333333">Update </span>**<span style="color: #333333">to save the page edits.</span>  
> Macro (inline-media-image)

> ℹ️ - <span style="color: #333333">You can use any SQL function and query based on the requirement. The macro is not specific to the queries mentioned in this article.</span>
> ℹ️ - <span style="color: #333333">Refer the MySQL link </span>[<span style="color: #333333">https://dev.mysql.com/doc/refman/8.0/en/functions.html</span>](https://dev.mysql.com/doc/refman/8.0/en/functions.html)<span style="color: #333333"> for more information.</span>


> Macro (__confluenceADFMigrationUnsupportedContentInternalExtension__)