-2

Can any one explain the difference between SQL(Structured Query Language) and SOQL(Salesforce Object Query Language)?

I need to convert dynamic SQL query into SOQL query using C#. Did anyone have any idea please help me...

Sample Inner Join Query:

SELECT "Salesforce"."Account"."Id", "Salesforce"."Account"."Name",
 "Salesforce"."Account"."Type", "Salesforce"."Contact"."FirstName",
 "Salesforce"."Contact"."LastName" 
FROM ( "Salesforce"."Contact" INNER JOIN 
"Salesforce"."Account" ON
 "Salesforce"."Contact"."AccountId" = "Salesforce"."Account"."Id") 
  • 1
    [Related question on SalesForce site](https://success.salesforce.com/answers?id=90630000000guwAAAQ) – ProgrammingLlama Jan 04 '18 at 06:11
  • @john I already saw few sites.but i need to convert dynamic SQL query into SOQL query using C#.you have a idea .... – VIGNESH ARUNACHALAM Jan 04 '18 at 06:21
  • 1
    What do you mean by 'using C#'. Are you writing a SQL - SOQL converter for it in C#? Do you expect someone to just built that and post it here? Or do you just want to run SOQL in C# that does what you posted? – Nick.Mc Jan 04 '18 at 06:24
  • @Nick.McDermaid I need to just convert SQL query into SOQL query and it into c#. – VIGNESH ARUNACHALAM Jan 04 '18 at 06:33
  • 1
    So you want to run a SOQL query from C#? I lookaed at this guide and the simple SOQL looks identical. Did you try it and see? https://developer.salesforce.com/page/Integrating_Force.com_with_Microsoft_.NET – Nick.Mc Jan 04 '18 at 06:46
  • @Nick I have only SQL query ,I need to change SQL query into SOQL Query and Run that SOQL query from C#..... – VIGNESH ARUNACHALAM Jan 04 '18 at 06:50
  • `I need to convert dynamic SQL query into SOQL query using C#.` Why do you need to do this? This sounds like a XY Problem. https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem – mjwills Jan 04 '18 at 07:34
  • 1
    The first practical attempt should be to just run the SQL you have, get an error message and find out how to solve that error message – Nick.Mc Jan 04 '18 at 08:06

2 Answers2

2

Some difference of SOQL:

  • No SELECT *
  • No views
  • SOQL read-only
  • Limited indexes
  • Object-relational mapping is automatic
  • Schema changes protected

Link : https://developer.salesforce.com/page/From_SQL_to_SOQL

Rai Vu
  • 1,595
  • 1
  • 20
  • 30
2

I searched for three minutes while my son was distracting me and found this:

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_understanding.htm

Which indicates this is valid syntax for selecting data from account and contact:

SELECT Account.Name, (
    SELECT Contact.FirstName, Contact.LastName 
    FROM Account.Contacts) 
FROM Account

You should start here and use similar constructs to add any other required info.

Again..... try something.. anything then you'll get an error message that you can research... or post on this site

Nick.Mc
  • 18,304
  • 6
  • 61
  • 91
  • Thanks a lot for spending your valuable time with me.Thanks once an for your suggestion bro.. – VIGNESH ARUNACHALAM Jan 04 '18 at 09:19
  • Three minutes isn't much time and I learnt something which is great. The important question is: if you are the person who has to complete this task, how is it that you have not managed to find this yet? It's not that far into the documentation, which is the _first_ place you should have looked? Did you even look there? – Nick.Mc Jan 04 '18 at 09:49