Re: Thorny SQL task
Posted in 1995
Amy, if I have understood you correctly, I would try something along the
lines of...
select id, whatever_else from sales_beings
where id not in (select id from customers)
UNION
select id, whatever_else from customers
where id not in (select id from sales_beings)
Regards, Pete Harris
On 15 Feb 1995, Amy Kleck wrote:
}
}
} In SQL, is it possible to select from either of 2 tables?
}
} I need to write some reports on a database that has several customer and
} data tables. One table has a list of sales people with IDs and names,
} another has some customer-generated data including an ID field.
}
} I need to try to select from one or the other: if the sales list has
} the ID that I'm after, then I get the name from that table. Otherwise
} I just print the ID. Of course, in my ACE file I have to order by the
} name (or ID).
}
} This is a case where some customers are going to give us a list of their
} sales people and some aren't, and the current goal is to handle all the
} logic within the report. Any chance that I can do this in an ACE
} script?
}
} Thanks.
} Amy Kleck
} akleck@best.com
} --
} //////////// Amy Kleck akleck@best.com ////////////////
} ///////////////////////////////////////////////////////////
} //////////////// Thank you for playing ////////////////
}