1-to-Many JSON Structures & typing in SQL queries


#1

Just installed DF to change an existing PHP-based website to use publicly exposed APIs rather than direct DB connectivity.

Currently, I have custom written SQL queries either in the DB as a View or within the PHP pages. But I need a more generic query that will be the primary basis of the API.

The structure will have 1-to-many relationships, i.e. 1 order could have multiple products, linked via a foreign key. How do I achieve this?

And how can I simply type in the SQL query using the DF UI while testing? When working, it will be converted to a view, then a “SELECT * FROM view” or whatever…


#2

Hi @tropicaltwin,

If trying to do more than a filter or group I recommend creating a stored procedure to fit your needs. This link may be of some use http://wiki.dreamfactory.com/DreamFactory/Features/Database/Records#Common_Parameters_and_Usage

Best,
Kevin