Results 1 to 1 of 1
-
13th Jan 2008, 01:29 AM #1OPMember
[TUT]SQL Toolbox: Using MS Excel with Multiple Queries
Hello,
This example will show you how to take two individual queries from the SQL Toolbox and add the results from one to the other.
The goal of this example is to know what the member's display_name is for a specific Custom Profile Field. The theory used here will work with any two queries, when each query contain an identical value, such as each query used in this example both contain the member id field.
Gathering Information: Identifying your Profile Field IDs
Three ways to find what the field_* (where * is the Custom Profile Field ID number) is for your individual Custom Profile Fields:
1a) ACP > SQL Toolbox
1b) ibf_pfields_data > Note the pf_id for the corresponding pf_title
2a) ACP > SQL Toolbox
2b) ibf_pfields_content > Note the field_* (where * is the Custom Profile Field ID number) and using the responses identify the Custom Profile Field used.
3a) ACP > Tools & Settings > Cache Control > profilefields > View Cache Contents
3b) Your prefix and id will show there; you will see the pf_id # and the corresponding info for that id such as: title, description, content.
Queries to Use:
ACP > Admin > SQL Toolbox > Scroll to the bottom and in "Run a Query" enter the following lines, where * is equal to the Custom Profile Field you you want to query:
Query A - Profile Fields and id:
Code:SELECT member_id, field_* pf_content FROM ibf_pfields_content
Code:SELECT id, members_display_name FROM ibf_members
Query omitting specific member group where * equals the group number:
Code:SELECT id, members_display_name FROM ibf_members where mgroup != *
Code:SELECT id, members_display_name FROM ibf_members where mgroup != * AND mgroup != * AND mgroup != *
1) Title your cells: A1 = member_id_pf; B1 = pf_content; C1 = results; D1 - leave blank; E1 = member_id_ml; F1 = display_name
(Key: pf = profile field; ml = member list)
2) Place your Query A info (See method below) in member_id (member_id_pf) and pf_id (pf_content) data into cells A2:A... and B2:B...
FYI: "..." depends upon how many members you have; Excel has a row limit of 65,536 so if you have more than this amount of members, you'll need to split it up.
3) Place your Query B info (See method below) member_id (member_id_ml) and display_name data into cells E2:... and F2...
4) In cell C2 (results) enter*:
Code:=LOOKUP($A$2:$A$21,$E$2:$E$21,$F$2:$F$21)
6) To carry your data down through your list simply click back into cell C2 and place your cursor into the lower right hand corner of the highlighted box; when the cursor turns into a cross-hair pointer, drag it down the column to the end of your data table. The results will automatically fill in for you.
7) If Query A contains less rows than Query B, the "results" column will show #N/A, representative of missing data.
*The formula was written to give a working example using only 21 rows. As you will have something different than this, change the number 21 in the formula to equal the number of rows you have. If you have 55305 your formula would look like this:
Code:=LOOKUP($A$2:$A$55305,$E$2:$E$55305,$F$2:$F$55305)
Layout and Formula:
Results:
Missing Data:
Method to place data into MS Excel:
1) Highlight all of the returned data from the "Result: Manual Query" Page. (Only the data; do not include the column titles.)
2) Ctrl +C
3) With MS Excel worksheet in view, click into the first appropriate empty cell where you want the data placed.
4) Ctrl +V
Sort Final Data Using MS Excel:
1) Select column C.
2) Toolbar > Data > Sort
3) At the "Sort Warning" prompt keep the radio dial set to "Expand the selection" and click "Sort"
4) Columns A, B, and C will be highlighted and the "Sort" prompt will appear.
5) Sort by: results > Ascending > My data range has: Header row
6) Click: "OK"
7) Your sorted results will appear.
FYI: 8) If you want to sort on the pf_content, select Column B instead of Column C or if you want to sort on member_id_pf, select Column A instead of Column C.
Screen Shots **
Sort Data First Prompt:
Sort Data Second Prompt:
Sort Data results:
Sort Data pf_contents:Lease Reviewed by Lease on . [TUT]SQL Toolbox: Using MS Excel with Multiple Queries Hello, This example will show you how to take two individual queries from the SQL Toolbox and add the results from one to the other. The goal of this example is to know what the member's display_name is for a specific Custom Profile Field. The theory used here will work with any two queries, when each query contain an identical value, such as each query used in this example both contain the member id field. Gathering Information: Identifying your Profile Field IDs Three ways to find Rating: 5Extremely helpful article about hiding your identity here
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Multiple Sites With Multiple Domains On Shared Hosting?
By DuckBre in forum Webmaster DiscussionReplies: 6Last Post: 24th Aug 2011, 03:47 AM -
SEO Benifits of sites on multiple Class C ranges... And even in multiple countries
By SplitIce in forum Webmaster DiscussionReplies: 3Last Post: 22nd Jan 2011, 02:57 AM -
The Ultimate HTML5 Toolbox: 60+ Articles, Tutorials, Resources and Inspiring Showcase
By SLiMRiDER in forum Webmaster ResourcesReplies: 6Last Post: 5th Jun 2010, 02:10 AM -
Internet Marketing ToolBox
By ACE in forum Webmaster ResourcesReplies: 2Last Post: 23rd Oct 2009, 09:06 PM -
vbSEO queries
By swapnil0545 in forum vBulletinReplies: 2Last Post: 13th Dec 2008, 03:27 AM
themaPoster - post to forums and...
Version 5.22 released. Open older version (or...