Skip to main content

#Sql Queries0 discussing

2 answers
0/9000

Hi Team, 

I am trying to create a validation rule where if I have a picklist value named " Current Medical " Yes/No

If "Current Medical " = Yes than "Benefits Carrier" Shows Up as a text field

If "Current Medical" = No , than "Benefits Carrier" Doesn't show up 

Thank you very much for your help. 

 

#Validation Rule  #Sql Queries  #Picklist Dependency

2 answers
  1. Feb 21, 2024, 2:42 PM

    Thank you so much, I really appreciate your help. 

0/9000

Is there any SQL Query to update an attribute Touch = 'Touch2' in the DE only if Propensity values lie between 0.6 and 0.7 and Lapsed days lie between 60 and 80 and Qualfying Date is null. Currently tried Update function in SQL , that seems to be not working 

 

#Marketing Cloud #SFMC Consultant #Sql Queries

2 answers
  1. Nobuyuki Watanabe (NAC / FPT Japan Holdings Group) Forum Ambassador
    Feb 6, 2024, 1:58 PM

    Hi, @Anirudh venugopal

    In Marketing Cloud, the UPDATE statement is not supported; only the SELECT statement is supported. Therefore, when configuring a SQL Query Activity, you can choose Update under Data Action. If you choose to use Update, it is necessary to set a primary key within the data extension.

     Hi, @Anirudh venugopalIn Marketing Cloud, the UPDATE statement is not supported; only the SELECT statement is supported.

0/9000

There is a DE called TestDE with EMAIL_ADDR , CUST_SEG, FREQ_SEG attributes. where  CUST_SEG has values x and y whereas FREQ_SEG has values a,b,c and d. Select 10% of audience from TestDE in such a way that CUST_SEG has equal distribution

 of x and y values whereas FREQ_SEG has equal distribution of a,b,c and d values. Kindly do help on the same.

 

#Marketing Cloud #Sql Queries

1 answer
  1. Feb 2, 2024, 4:43 PM

    I would suggest looking into SQL functions Row_Number(), NTILE() in conjunction with Partition BY and OVER functions. These functions should allow you to achieve your desired results. 

     

    I personally utilize partition by very frequently for pulling test audiences from live data that capture all field variations used in dynamic sends. HTH

0/9000

Can anybody help with SQL Query to pull date 1 day greater than current date apart from the standard condition ie CHKOUT_DT  = DATEADD(dd,1,GETDATE()) which seems not be working properly

 

#Sql Queries #SQL

1 answer
  1. Nobuyuki Watanabe (NAC / FPT Japan Holdings Group) Forum Ambassador
    Jan 5, 2024, 10:28 AM

    Hi, @Anirudh venugopal

    The function GetDate() displays the time up to seconds, so it is necessary to use conversion functions like Convert to eliminate the display of hours, minutes, and seconds.

     

    Additionally, GetDate() is presented in the CST (Central Standard Time) timezone. Therefore, instead of simply adding one day, you should add the time corresponding to your timezone. In my country, Japan, we use JST (Japan Standard Time), and there is a 15-hour difference with CST. So, to represent one day later, you should add 15 hours to 24 hours. (= 39 hours.)

     

    Please adjust the logic according to your country's timezone:

    CHKOUT_DT = Convert(Date,DateAdd(hh,39,GetDate()),111)

0/9000
1 answer
  1. Apr 3, 2023, 10:52 AM

    Hello @Anirudh Venugopal Warrier,

     

    Primary key violations occur when an attempt is made to insert a record with a primary key value that already exists in the table. Here are a few ways to resolve primary key violations in SQL queries:

    1. Check the input data: Ensure that the input data is correct and does not contain any duplicate values. If the input data is coming from a file or another database, verify that it is correct and does not contain any errors.
    2. Use a MERGE statement: Use a MERGE statement to update existing records and insert new records. A MERGE statement can be used to perform both INSERT and UPDATE operations in a single statement.
    3. Use a subquery: Use a subquery to check if the record already exists before inserting it. The subquery can check for the existence of the primary key value in the table and return a boolean value that can be used to determine whether to insert the record or not.
    4. Use an UPSERT statement: An UPSERT statement is a combination of an INSERT and an UPDATE statement. It will try to insert a record, and if it already exists, it will update the existing record.
    5. Use a transaction: Wrap the INSERT statement in a transaction to ensure that the primary key violation is caught and handled correctly. This will ensure that the entire operation is either committed or rolled back in case of an error.
    6. Remove the primary key constraint: If you do not need the primary key constraint, you can remove it from the table. However, this is not recommended as it can lead to data inconsistencies and make it difficult to maintain the integrity of the data.

    By using one of these methods, you should be able to resolve the primary key violation issue in your SQL query. 

0/9000
2 answers
  1. Nobuyuki Watanabe (NAC / FPT Japan Holdings Group) Forum Ambassador
    Apr 3, 2023, 8:39 AM

    If you want to know the records of the remaining paths, update a Marketing Cloud contact record in Journey Builder using the "update contact" activity. And you can query the DE.If you want to know the records of the remaining paths, update a Marketing Cloud contact record in Journey Builder using the

0/9000
2 answers
  1. Mar 28, 2023, 8:05 AM

    Hello @Anirudh Venugopal Warrier,

    SELECT *

    FROM [Your Data Extension]

    WHERE DateField >= DATEADD(day, 30, GETDATE())

    Replace "Your Data Extension" with the name of your data extension, and "DateField" with the name of the date field you want to filter by. This query will select all records where the value in the "DateField" is equal to or greater than 30 days ahead of the current date.

0/9000

Is it possible to pull Einstein Engagement Frequency data into a SQL query? Example, target unsaturated contacts, but in a SFMC query.

 

#Sql Queries  #Einstein Analytics  #Marketing Cloud

1 answer
0/9000

Non-SQL Developer Friends,

Our team has been using SFMC for a while now, and rely heavily on another team within our organization to write SQL queries for our DE's for email studio email sends and journeys. 

 

Our marketing team is hoping to take on the responsibility of building those highly targeted DE's moving forward, but this group is not as well versed in writing SQL.

 

Are any of you in the same boat? I imagine ours cannot be the only Marketing team that has come up against this issue. What are others doing to build their segmented email lists in SFMC without heavy SQL query writing? I'd love some insight! 

 

Maria

16 comments
0/9000