Weld logo
hubspot logo
Hubspot SQL templates
New companies by month
Retrieves a list of new companies created each month from the HubSpot integration and groups them by month. The results are ordered by month.
Closed won deals by owner
Retrieves the number of closed won deals by owner from HubSpot and orders them in descending order based on the number of deals.
Closed lost deals by owner
Retrieves the number of closed lost deals by owner from HubSpot and orders them by the highest number of deals. It uses a left join to match the owner ID from the deals table to the owners table and concatenates the first and last name of the owner for readability.
Closed won deals amount by owner
Retrieves the total amount of closed won deals for each owner in HubSpot and orders them in descending order.
Emails by owner
Retrieves the number of emails sent by each owner in HubSpot by joining the engagements and owners tables and grouping the results by owner.
New deals by month
Retrieves the number of new deals created each month from HubSpot and organizes them by month.
Calls by owner
Retrieves the number of calls made by each owner in HubSpot and displays it alongside their first and last name. It uses a left join to connect the engagements and owners tables and filters the results to only include calls. The output is grouped by owner.
Meetings by owner
Retrieves the number of meetings organized by each owner in HubSpot and displays it alongside their first and last name. It uses a left join to connect the engagements and owners tables and filters the results to only include meetings. The output is grouped by owner.
Tasks completed by owner
Retrieves the number of completed tasks for each owner in HubSpot, using a left join between the engagements and owners tables. The result includes the owner's first and last name, as well as the count of completed tasks.
Deals by deal stage
Retrieves the number of deals in each stage of the sales pipeline from HubSpot and groups them by their respective stage labels.
Conversion from contacts to deals by owner
Converts contacts to deals by owner in HubSpot, displaying the owner's name, the number of contacts they have, the number of deals they have, and the conversion rate between the two. It uses left joins to connect the necessary tables and groups the results by owner.
New contacts by month
Retrieves the number of new contacts added to HubSpot each month and groups them by month. It uses the date_trunc function to extract the month from the createdAt field and orders the results by month.
© 2025 Weld. All rights reserved.