delete from a.doc_data where sur_doc_nbr in (select sur_doc_nbr from a.doc where deld=1)
delete from a.doc_attr where sur_doc_nbr in (select sur_doc_nbr from a.doc where deld=1)
delete from a.doc where deld=1
Wednesday, March 18, 2009
Friday, March 06, 2009
aggregates not allowed in WHERE clause
use HAVING, e.g.
SELECT player_name, AVG(score) as score FROM NBA.score_box WHERE box_year > 2004 GROUP BY player_name HAVING count(Game) > 100 ORDER BY score
SELECT player_name, AVG(score) as score FROM NBA.score_box WHERE box_year > 2004 GROUP BY player_name HAVING count(Game) > 100 ORDER BY score
Subscribe to:
Posts (Atom)