TAILIEUCHUNG - Take Advantage of Using Subqueries

Đi Advantage của Sử dụng Subqueries Tôi nghĩ rằng có một số bản sao tại một trong các bảng của tôi. Ngoài ra, tôi cần phải biết những thành phố (và khu vực) trong một cơ sở dữ liệu Northwind đã có hơn một khách hàng ở trong đó. | Take Advantage of Using Subqueries I think there are some duplicate records in one of my tables. Also I need to know which of the cities and regions in a Northwind database has more than one customer in it. How can I use subqueries to perform these tasks Technique To get the answers to the situations just presented you will use a subquery in your T-SQL statement. A subquery is a complete SELECT statement. Following is the query that will be used for this How-To. It uses a subquery in the WHERE clause of the outer or main query SELECT From Customers WHERE IN SELECT FROM Customers As Tmp GROUP BY HAVING Count 1 And Region ORDER BY You can see in this query that in the WHERE clause the City column in Customers is used with an IN operator. The subquery in this case returns all the cities that are assigned to more than one customer. Note In this case you are using a subquery much as you would a joined table or against another view. The nice thing about using the subquery is that you can see the entire query here instead of opening another view that is joined. Performancewise there is no benefit or degradation in using subqueries. In addition to using subqueries in WHERE clauses you can use them anywhere you would use an expression. Steps Open and run the Visual Basic .NET-Chapter 6 solution. From the main form click on the button with the caption How-To . Much like a couple of the other How-Tos in this chapter you will see the query displayed in the label on the top of the form with the results displayed in the data grid object below see Figure . 1. Create a Windows Form. Then place the controls listed in Table with the properties set displayed in Figure . Table . Control Property Settings for This How-To Object Property Setting Label Text SQL Statement Label Name lblSQLString Label .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.