You need to use WP_Query, see the usage information at the top [wp_reset_postdata()]
You should avoid query_posts() because it overwrites the main query. This function is rarely safe to use https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts