I'm developing a PostgreSQL/PostGIS backend for a MapInfo application. One of the procedures available to users is to select items on the map (from a table `orders` stored in the database) and then copy the selected items in to a different table (`proposed_order` - also stored in the database). In the desktop only version, the code works something like this:
Select item_ref From Selection Group By item_ref InTo Item_Refs_To_Copy
Select * From orders Where item_ref In (Select item_ref From Item_refs_To_Copy) Into Order_Items_To_Copy
Insert Into proposed_order (Select * From Order_Items_To_Copy)
The problem is that I can't make a selection in the database based on the `item_refs` in the local selection table, the only way I can think of doing it is building up a string of comma-separated item_refs e.g. `sListItemRefs` and then sending that off to the database as a `Select * from orders Where item_ref In (sListItemRefs)` command with Server_Execute.
As a side note, it would be great it this forum could provide the facility to insert code snippets like Stack Overflow or the MapInfo-L group.
Thanks,
Alex