function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SDFC FirstLevelerSDFC FirstLeveler 

I am trying get records in an SObject list

public class particular {
    public string products    {get;set;}
    public Particular__c unit_price {get;set;}
    public Particular__c quantity   {get;set;}
    public Particular__c total {get;set;}
    public invoice__c invoice{get;set;}
    public list<particular__c> lstPar {get;set;}
    
    public particular(ApexPages.StandardController controller) {
    lstPar= [select Invoice__r.Invoice__c, Particular_Name__r.Product, Line_Total__c, 
    Quantity__c, Unit_Price__c from Particluar__c];    
    }
}

Hi Experts,
In above code i have two custom objects:

Particulars__c and Invoice__c.
I want to get records of the particluar__c and it is having MD relationship with invoice and lookup with Product.

Ahmad J. KoubeissyAhmad J. Koubeissy
what is your problem ?
HARSHIL U PARIKHHARSHIL U PARIKH
Are you looking for something like these?
List<Particulars__c> EachParticularRecordWithAssociatedInvoices = [Select Id, Particular_Name__c,(Select Id, Line_Total__c, Quantity__c, Unit_Price__c from Invoices__r) FROM Particulars__c ];
This query will give you each record of Particulars__c object one by one by having all Invoice__c records for each one.