on ‎2013 Sep 18 6:23 AM
Request clarification before answering.
Hi,
As suggested above try Join conditions. If you don't know how, go to:
It's a quite good tutorial, you should find what you need there.
Regards,
Bartłomiej.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
also check this, googling is not that hard
http://stackoverflow.com/questions/9853586/sql-join-multiple-tables
I hope that I've helped.
hi all,
Is Freehand sql different from native sql?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henry,
So we need to write sql's as we write in Oracle/sql server? By this systax changes for different databases?
Also can you please suggest on using the below bolded sql's with below table structures? For the above mentioned scenario.
emp ---------------> empId-empName-empSal-deptId
dept ---------------> deptId-deptName-deptMngr-deptHrId
hr ---------------> hrId-hrName
first find the numberr of entries by using this query
select d.deptId,d.deptName,d.deptMngr,h.hrName from dept d,hr h
where d.deptHrId=h.hrId
next depending upon the result
select
e.empId,e.empName,e.empSal,dh.deptName,dh.deptMngr,dh.hrName
from emp e, (select d.deptId,d.deptName,d.deptMngr,h.hrName from
dept d,hr h where d.deptHrId=h.hrId) dh
where e.deptId=dh.deptId
If we want using joins
select e.empId,e.empName,e.empSal,d.deptName,d.deptMngr,h.hrName
from emp e
inner join dept d on e.deptId=d.deptId
inner join hr h on h.hrId=d.deptHrId
TIA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm guessing it shows you only the fields you've selected from Account. Try adding the columns from Contact and from Opportunity for example
Select col1.Account col2.Account col1.Contact col1.Opportunity from Account
Join Contact...
Join Opportunity...
Just like in the tutorial I've sent you. They're example is like this:
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID
Note that they use fields from the joined tables after the word "SELECT" in the select statement.
Let me know if this solves your problem.
Regards,
Bartłomiej.
Hi,
I'd recommend using SQL Join conditions.
regards,
H
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.