balderdashy / waterline-docs

WARNING: The content in this repo is out of date! See https://github.com/balderdashy/sails-docs for the most up-to-date documentation
452 stars 161 forks source link

How to use .populate() to join three tables? #104

Open chenweiyj opened 8 years ago

chenweiyj commented 8 years ago

I want to select data from three tables via waterline, the SQL might like this

select p.name, p.code, s.stock, b.spec, b.batchno
from stock as s, batch as b, product as p
where s.user = userId and s.batch = b.id and b.product = p.id

How to realize this by ORM method?

AzriRosehaizat commented 8 years ago

Any ideas?

dv336699 commented 8 years ago

this repo is for issues regard waterline documentation, I think you should get an answer if you post your question (which is not an issue) on stackoverflow