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 |
|
theseeker
Starting Member
2 Posts |
Posted - 2010-08-07 : 03:09:37
|
| SELECT count(iceCreamType) as 'Amount' FROM iceCreamTable WHERE Amount > 3 Group by iceCreamTypeThey say that column is not found. how can that be? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-08-07 : 03:13:46
|
you can't reference a column alias in your query like that.You should put the condition in the HAVING clauaseSELECT count(iceCreamType) as 'Amount'FROM iceCreamTableWHERE Amount > 3Group by iceCreamTypehaving count(iceCreamType) > 3 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
theseeker
Starting Member
2 Posts |
Posted - 2010-08-07 : 03:29:47
|
| seems like that does not seems to work still. is there any other ways |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-08-07 : 06:04:08
|
What does not work ? Do you get any error ? Post the error message.Also post some sample data and show the required result KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-08-07 : 07:27:37
|
| what is the result you expect tooWith RegardsKashyap M |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-09 : 03:08:57
|
| Have you tried this?select * from(SELECT iceCreamType,count(iceCreamType) as AmountFROM iceCreamTableGroup by iceCreamType)as tWHERE Amount > 3MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|