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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 cant get these two tables to join

Author  Topic 

ncp905
Starting Member

4 Posts

Posted - 2009-03-17 : 22:08:26
Hi again the below one doesn't work. It spits out a unknown column 'classCode'

Select className FROM class,class_section
WHERE class.classCode= class_section.classCode
GrOUP by className Having COUNT(csNum) >= 2 AND classCost > 400;


how would i join 2 tables together while only selecting one field from thats from the parent table called class?

I tried select className,*... and it gave same message.

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-03-17 : 23:12:59
sounds like one of those 2 tables doesn't have the column: [classCode]. Script out the both table definitions and post them here.

>>how would i join 2 tables together while only selecting one field from thats from the parent table called class?
If you don't want all columns from all tables returned then explicitly list just the ones you want. Qualify the columnNames with tablename.columnName (or tableAlias.columnName)

Be One with the Optimizer
TG
Go to Top of Page

ncp905
Starting Member

4 Posts

Posted - 2009-03-18 : 07:11:33
Hi TG here are the row and columns of table : class

'classCode', 'char(5)', 'NO', 'PRI', '', ''
'className', 'varchar(25)', 'YES', '', '', ''
'classCost', 'decimal(5,2)', 'YES', '', '', ''
'classHours', 'tinyint(4)', 'YES', '', '', ''
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-18 : 07:15:40
And Class_Section table?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -