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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-07-30 : 07:54:51
|
| Cristina writes "I have three tables: T_ArticleTypeList(id,art_type), T_ArticlesList(id, type_id,...) and T_Inventory(id, art_id, inventory_id,...)I want a querry that returned all the articles that are not in a Inventory, and I wrote this :select distinct T_iArticlesList.id, T_iArticlesList.art_name, T_iArticlesList.art_type_id,T_iArticleTypeList.art_type_code, T_iArticleTypeList.art_type_name,T_iArticlesList.art_inv_no,T_iArticlesList.commentsfrom T_iArticlesList,T_iArticleTypeList,T_iInventorywhere (T_iArticlesList.id not in (select T_iInventory.art_id from T_iInventory)) and (T_iArticlesList.art_type_id=T_iArticleTypeList.id)When table Inventory is empty the querry dosn't return me all the articles. More than that, the querry dosn,t return any article. I want to know why and how can I resolve that problem?" |
|
|
Amethystium
Aged Yak Warrior
701 Posts |
Posted - 2003-07-30 : 08:06:01
|
| [CODE]SELECT DISTINCT A.ID, A.ART_NAME, A.ART_TYPE_ID,B.ART_TYPE_CODE, B.ART_TYPE_NAME,B.ART_INV_NO,B.COMMENTSFROM T_IARTICLESLIST AS AINNER JOIN T_IARTICLETYPELIST AS BON A.ART_TYPE_ID = B.IDWHERE A.ID NOT IN (SELECT ART_ID FROM T_IINVENTORY)[/CODE]---------------Shadow to Light |
 |
|
|
|
|
|
|
|