Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
saidev
Posting Yak Master
101 Posts |
Posted - 2006-08-14 : 18:31:25
|
Hi Guys,I have two tables A and B, and i want to group by using the tbl A (i,e 1---> 100, 2 -----> 200, and so on.) can you guyshelp me with the Query. Appreciate your helpThanks,A B1 100 2 1003 1004 2005 2006 200 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-08-14 : 18:49:11
|
I have no idea what you are after.Please try again to explain what you want, with table structures, sample data and your expected results.CODO ERGO SUM |
 |
|
saidev
Posting Yak Master
101 Posts |
Posted - 2006-08-14 : 19:00:18
|
Here is another example.if i select 1003 in tbl-A then i need to pick all '1003's in tbl- B and so on...Thanks Tbl-A id group 1003 GLOBAL MARKETING RESOURCE 1005 DDB NEEDHAM (IL) Tbl-B id1 group1 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1003 GENERAL-CASH 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) 1005 General (initial load) |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-08-14 : 19:43:51
|
So what are your expected results?CODO ERGO SUM |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-08-15 : 02:16:13
|
Maybe an INNER JOIN will suffice?Peter LarssonHelsingborg, Sweden |
 |
|
saidev
Posting Yak Master
101 Posts |
Posted - 2006-08-15 : 11:01:48
|
If i select 1003 in tbl A then i need to get all 1003's in tbl BThanks, |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-08-15 : 11:46:24
|
[code]select *from tblA inner join tblBon tblA.id = convert(int, tblB.id1)where tblA.id = 1003[/code] KH |
 |
|
|
|
|
|
|