| Author |
Topic |
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-04-11 : 09:54:39
|
HiI have a tables like belowTblAID(unique)---SessionID(unique)----RefTblBVisitID(unique)---SessionID(Multiple)----Page--PdcodeMy question : How Do I bring all rows from TblB and matching single row from TblA (I have more than one sessionID in TblB and only one Unique SessionID in TblA).The Select query I was using is SELECT PageViews.ID AS ID, PageDetailView.VisitID, PageViews.PageAccessed, PageDetailView.PageAccessed AS Expr1, PageViews.QueryString, PageDetailView.QueryString AS Expr2, PageViews.Referer, PageViews.SessionID, PageDetailView.SessionID AS Expr3, PageDetailView.PdtID, PageDetailView.Pcode, PageDetailView.CustID, PageDetailView.OrdTot, PageViews.[Date]FROM PageViews RIGHT OUTER JOIN PageDetailView ON PageViews.SessionID = PageDetailView.SessionIDORDER BY PageViews.ID DESC |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-11 : 11:57:43
|
| just join them using the matching SessionID column. Or was your question to display the TblA information only once without repeating for each TblB row? |
 |
|
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-04-14 : 04:39:34
|
Hi VisakMy question was display the TblA information only once without repeating for each TblB row.quote: Originally posted by visakh16 just join them using the matching SessionID column. Or was your question to display the TblA information only once without repeating for each TblB row?
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-14 : 04:43:39
|
| So how do you want to show the matching values from TblB? or are you interested in showing only one value from TblB (latest,earliest,random) ? |
 |
|
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-04-14 : 05:01:23
|
Hi I want All rows from TblB and single matching (matching by sessionID)row from TblA but not repeated rows from TblA. Sorting by TblB.ID Desc.TblA has Unique SessionID and there is no duplicatesTblB Has Many SessionID I am tring to create views first, then use asp.net to call views to display the tailored information about web stats, sales etc.quote: Originally posted by visakh16 So how do you want to show the matching values from TblB? or are you interested in showing only one value from TblB (latest,earliest,random) ?
|
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-14 : 05:09:57
|
This is a presentation issue.If you have one record in tblA and two records in tblB with same SessionID, you get row "rows" back from tblA because you match that row two times.Just turn on "Suppress/hide duplicate values" in your report designer. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-04-14 : 06:10:36
|
HiThanks for the reply. I will try to log all session ID to one table. Need Some advice on the following. 1. I am going to create many "Views" from One table.2. AM I ABLE TO USE "Procedures" for the "Views" ?quote: Originally posted by Peso This is a presentation issue.If you have one record in tblA and two records in tblB with same SessionID, you get row "rows" back from tblA because you match that row two times.Just turn on "Suppress/hide duplicate values" in your report designer. E 12°55'05.25"N 56°04'39.16"
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-14 : 06:29:41
|
| You can use procedures on your views. You use views in same manner as tables as views are nothing but virtual tables. Also you can create more than 1 view from a table. |
 |
|
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-04-14 : 06:58:57
|
HiThanks a lot guys.quote: Originally posted by visakh16 You can use procedures on your views. You use views in same manner as tables as views are nothing but virtual tables. Also you can create more than 1 view from a table.
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-14 : 07:09:39
|
quote: Originally posted by Vaishu HiThanks a lot guys.quote: Originally posted by visakh16 You can use procedures on your views. You use views in same manner as tables as views are nothing but virtual tables. Also you can create more than 1 view from a table.
You are welcome |
 |
|
|
|