Say I have to following setup ( just a small section):

TUPLE: product id brand name size ;

product "product" {
    { "id" "id" +db-assigned-id+ }
    { "brand" "brand" VARCHAR }
    { "name" "name" VARCHAR }
    { "size" "size" DOUBLE }
} define-persistent

TUPLE: fact id date-id product-id amount ;

fact "fact" {
    { "id" "id" +db-assigned-id+ }
    { "date-id" "date_id" INTEGER { +foreign-id+ date "id" } }
    { "product-id" "product_id" INTEGER { +foreign-id+ product "id" } }
    { "amount" "amount" INTEGER }
} define-persistent

I would love to be able to select by example across the foreign-id. So
for example:

T{ fact } T{ product } "foobar" >>name >>product-id select-tupes

And have that return all facts where the product has the name of
"foobar".

To my eyes that seems like a cleaner solution then even sql itself.

I have tried to do the above and no joy, the best I can do is break it
up into two queries the first to fetch the ids of products with a name
of "foobar" and the second to fetch all the facts with those
product-ids.

Is there a join syntax that I am missing? If not, I would appreciate
any pointers as to how and where to stick this into the db/db.tuples 
structure.

Thanks.


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to