This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
The ability to efficiently do this will depend on what features your database supports.
For example, if your database is postgresql, using the group by clause in your query, then to "find all item_numbers for which there are more than one supplier" (assuming that the item_number, supplier combination is unique in this table) might look like:
This would get the item_numbers for which there are more than occurence (supplier) in the table.
though you would probably also want to join this with the items table to display more than just the item id. This example uses the group by clause as a subquery that is joined with (the items) table, which is useful to read all the needed fields in one query.
assuming that there is a table ITEM with at lest columns (ID, NAME).
if there are manyresults and you would like to show them as so many per page, you may be able to use the limit and offset constructs as well, so the query only returns the subsection that is being displayed. Though, unless you also specify an order by constraint, the items returned in a given group by the limit / offset on their own are not guaranteed to be the same for repeat invocations of the same query, as when the data is modified.
Error: Keyboard not attached. Press F1 to continue.