Queries like this can get tricky depending on your table design.
If your table looks like this:
<pre>CREATE TABLE MyTable
ParentSequence INT, /*A number which is unique per parent*/
You can do something like this
WHERE EXISTS (SELECT * FROM MyTable WHERE MyTable.ParentId = ParentTable.ParentId AND ParentSequence = 1)
AND EXISTS (SELECT * FROM MyTable WHERE MyTable.ParentId = ParentTable.ParentId AND ParentSequence = 2)</pre>
If you want to return the records that simply have 2 or more records in the MyTable table then something like this would work.
JOIN (SELECT ParentId, count(*) ct
GROUP BY ParentId
HAVING count(*) >= 2) a ON a.ParentId = ParentTable.ParentId</pre>
well ur question is not clear, if u r a beginner,u might trouble to get the details from a table,
to retrive all columns and rows information
type the query "select * from parent;",
if u need to get the particular column or row information u need the condition to retrive the data as "select age from parent where age>40;" this is the code to retrive
Last Wiki Answer Submitted: September 2, 2011 4:18 am by Denny Cherry64,520 pts.