You are here: Re: problem with count, group by and ntext « MsSQL Server « IT news, forums, messages
Re: problem with count, group by and ntext

Posted by Erland Sommarskog on 04/10/06 13:28

Igor (jerosimic@gmail.com) writes:
> I wrote it like this:
> SELECT projects.project_id, projects.project_title,
> projects.project_description, (SELECT count(*) FROM users WHERE
> projects.project_id=users.project_id) AS number_od_users
> FROM projects;

This is most likely slower than the version I suggested. Sub-selects in the
SELECT list often gives poor performance.

> what does "coalesce" do?

coalesce takes list of values, and returns the first non-NULL value in the
list, or NULL if all values are NULL.

coalesce() is described in Books Online, if you want to read more.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация