| Author |
Topic |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-08-24 : 07:47:56
|
| i joined 2 tables using join query ... Now i want to use the joined table ..What can i do |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-24 : 07:51:19
|
what do you mean by joined table? are you asking about using joined query as a new table? if yes, do likeselect columns...from(your join query)t ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-08-24 : 08:00:49
|
| Table 1 join table 2--->Resulthow to store or use result for next query |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-08-24 : 08:09:39
|
| Table 1 join table 2--->XI need to use x as input ... when using join query a dynamic table generated i need that table sir... |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-08-24 : 08:27:50
|
| i received this error Msg 263, Level 16, State 1, Line 14Must specify table to select from.Msg 1038, Level 15, State 5, Line 14An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2010-08-24 : 08:29:10
|
quote: Originally posted by jafrywilson i received this error Msg 263, Level 16, State 1, Line 14Must specify table to select from.Msg 1038, Level 15, State 5, Line 14An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name.
You'll need to put aliases on the columns that are using aggregates or functions.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-24 : 08:31:34
|
quote: Originally posted by jafrywilson i received this error Msg 263, Level 16, State 1, Line 14Must specify table to select from.Msg 1038, Level 15, State 5, Line 14An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name.
Post the full code you used. I think you can very well make use of derived table than temporary tableMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-24 : 08:36:53
|
quote: Originally posted by tkizer
quote: Originally posted by madhivanan
quote: Originally posted by tkizer Please see my previous post.
Seems you are on 24/7 support today Still problem at your project?
Got paged at 12:30am, was on the phone until about 1:30am. Then got paged again at 3:30am and am still on the phone (it's 5:30am here). Not sure when I get to go back to sleep.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
Ok. Let it be solved soon MadhivananFailing to plan is Planning to fail |
 |
|
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-08-24 : 08:36:57
|
| select tbl_product.MPN_SKU,tbl_product.Product_Name,tbl_merchant.Price,tbl_merchant.Merchant from tbl_product INNER JOIN tbl_merchant on tbl_product.mobid=tbl_merchant.mobidselect mobid, max(case when seq=1 then merchant else null end) as min_merchant,max(case when seq=1 then price else null end) as min_price,max(case when bseq=1 then merchant else null end) as max_merchant,max(case when bseq=1 then price else null end) as max_pricefrom(select row_number() over (partition by mobid order by price) as seq,row_number() over (partition by mobid order by price desc) as bseq,mobid, merchant,pricefrom tbl_merchant)twhere seq=1or bseq=1group by mobidi need these two answers in a single table |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-24 : 08:42:29
|
| Try thisselect t1.*,t2.Product_Name from (select mobid, max(case when seq=1 then merchant else null end) as min_merchant,max(case when seq=1 then price else null end) as min_price,max(case when bseq=1 then merchant else null end) as max_merchant,max(case when bseq=1 then price else null end) as max_pricefrom(select row_number() over (partition by mobid order by price) as seq,row_number() over (partition by mobid order by price desc) as bseq,mobid, merchant,pricefrom tbl_merchant)twhere seq=1or bseq=1group by mobid) as t1 INNER JOIN tbl_product as t2 on t2.mobid=t1.mobidMadhivananFailing to plan is Planning to fail |
 |
|
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-08-24 : 08:46:31
|
| thank u so much... Its working......... |
 |
|
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-08-24 : 08:48:46
|
| thank u tkizer..for your support |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-24 : 08:50:30
|
quote: Originally posted by jafrywilson thank u so much... Its working.........
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|