You need to sign in to do that
Don't have an account?
mbforce
e.g. if user input Student Name as John and Course as SFDC and click search button, query should retrieve details (Student Name, course Name, start date , end date, fees) of all the student with name john and enrolled fo course SFDC
Note: Object Student and Object Cource have many to many relationship
Need help in constructing SQL query.
I have created 2 object Student and Course with following fields
Student - Student Name, address, DOB, Phone Number, Course joined
Course - Course Name, Start Date , end date, Fees,
also created a VisualForce page with four input textbox (Student Name, Course, Start date, End Date)
user will enter value in some or all of these boxes and click search button on VF page I want to construct Query which will retrieve data from Student and Course object based on user input
Student - Student Name, address, DOB, Phone Number, Course joined
Course - Course Name, Start Date , end date, Fees,
also created a VisualForce page with four input textbox (Student Name, Course, Start date, End Date)
user will enter value in some or all of these boxes and click search button on VF page I want to construct Query which will retrieve data from Student and Course object based on user input
e.g. if user input Student Name as John and Course as SFDC and click search button, query should retrieve details (Student Name, course Name, start date , end date, fees) of all the student with name john and enrolled fo course SFDC
Note: Object Student and Object Cource have many to many relationship
I have referred following link but couldnt construct query
http://www.salesforce.com/us/developer/docs/soql_sosl/salesforce_soql_sosl.pdf
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_soql.htm
please help in constructing query / provide syntax of the query.
Thanks,
Manish B.
You have to use a SOSL query,
This has to be done on Only one master Object, which has reference to the look up related Object Field.
Something like this,
Find Student Name, course Name, start date , end date, fees FROM Student__c WHERE Name = 'Manish' and Student__r.Course__c.CourseName__c = 'sfdc' ;
Regards,
Ashish