At 19:02 30/12/99 +0530, mathur wrote:
>I need to check for particular records whether they exist or not
>
>How can I do that ?
Write a query.
But seriously, there isn't enough information to here to make a proper
response. I guess you want to check if a particular record exists and if it
does take some action....
DELETE * FROM orders
WHERE EXISTS (SELECT bad_supplier.id FROM bad_supplier
WHERE badsupplier.id=orders.supplier_id);
....In which you can't - MySQL didn't support sub-queries last time I
checked. You need to use a programming language to retreive a set of values
then generate a query for each element of the set to get your result.
Unless....you really want to do a join e.g.
SELECT orders.number from orders, order_lines
WHERE orders.id=order_lines.order_id
AND order_lines.item="furby"
GROUP BY orders.number;
- this would give you the order numbers for orders which include 'furby'
from a badly designed schema.
HTH
Colin

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.