Announcing Multiple Columns



Change the CQWP Style with VendorCustomStyle to render multiple columns with Headers Open the Home Page of the site and click Site Actions, and then click Edit Page. Now on the CQWP click edit and then click Modify Shared Web Part and expand the Presentation category. In the Styles section select VendorCustomStyle from Item style box. Return Column: Can be either a table column # (ex: 2) or a column heading ('MyField'). I recommend headings because they help self-document formulas and formulas won't break if columns are rearranged. Lookup Key(s) Can be one or more values to search for. The first value must be located in the first column.

  1. Announcing Multiple Columns Images
  2. Announcing Multiple Columns Pictures
  3. Announcing Multiple Columns Definition

Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial.

You don't have to retrieve all the information from a table. You can retrieve only the information you want from the columns you want and filter out the rest.

SQL Used

Retrieving a single column:

Examples:

Retrieving multiple columns:

Examples:

See all of the SQL used in SQL Basics in the SQL Basics Cheat Sheet.

In the previous video we used the selectstar from table query to retrieve all 0:00
Announcing
information in a table, but you may notwant to bring back all the information. 0:05
Often you want a smallsubset of information. 0:10
This can be particularly helpful ifyou don't want to bring back sensitive 0:13
Like the addresses or dates of birth. 0:18
Let's take a look at some simpleways to retrieve only some 0:21
ColumnsAnnouncing
Let's start with all the informationfrom the patrons table. 0:26
The asterisk, or star, is short hand forall of the column named in the table. 0:34
Now, what if I wanted to retrieve onlythe emails from our patrons table? 0:39
We still want to select somethingfrom our patrons table. 0:44
All we need to do is change the asterisk,remember? 0:50
We can replace it withthe column name we want. 0:57
As you can see this selects allthe emails from our patrons table. 1:05
Multiple
What if we wanted all the firstnames in our patrons table. 1:12
You just to write the name of the firstname column first underscore name 1:17
Okay, let's change that back. 1:27
Having either all columns or a singlecolumn returned back has limited utility. 1:33
Remember, the power of SQL is that youcan retrieve any subset of information 1:38
from a table without beingdestructive to the underlying data. 1:43
Nothing is deleted,it's just presented differently. 1:47
Let's say I wanted to send out a librarynewsletter talking about the new book 1:52
How do I go about retrievingboth the first name and 1:58
In other words, 2:02
how do I select two columns of datafrom the database with one query? 2:03
SQL makes this kind oftask pretty easy on us. 2:08
each column I want witha comma in the SQL query. 2:13
The great thing is that I can changethe ordering of the columns how I see fit. 2:19

Announcing Multiple Columns Images

Since the recap,the area between the SELECT and 2:34
the FROM keywords is the columns youwant to get the information from. 2:37
SELECT * FROM patrons is a lot shorterthan including all of the column names. 2:42
You're a better person than me if youcan remember all the column names. 2:46

Announcing Multiple Columns Pictures

Let's do some challenges tosolidify what we've learned here. 2:49

Announcing Multiple Columns Definition

You need to sign up for Treehouse in order to download course files.