SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 30th, 2004, 01:58 PM
kila kila is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 90 kila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 33 m 59 sec
Reputation Power: 5
Simple: Need to add a field to SQL query. (i'm terrible)

Guys,

Need to add the field "DESCRIP" from table "TBLMANUFACTURERS" to the following query.. (last time i tried this i ended up with 16 dups of every product. It's so simple it hurts but i need to see the right way to understand..)

SELECT TBLINVENTORY.*, TBLMANUFACTURERS.NAME AS ManufName, TBLGROUPS.GROUPID, TBLGROUPS.NAME AS GroupName, TBLSHIPTIME.SHIPTIME AS ShipTimeDesc, TBLSHIPTIME.IMG AS ShipTimeImg, TBLGROUPS.DESCRIP AS GroupDescrip, TBLINV_UNITS.UNIT AS UNITNAME
FROM TBLINV_UNITS RIGHT JOIN (TBLSHIPTIME RIGHT JOIN (TBLMANUFACTURERS INNER JOIN (TBLINVENTORY INNER JOIN (TBLGROUPS INNER JOIN tblInventoryGroups ON (TBLGROUPS.GROUPID = tblInventoryGroups.GroupID) AND (TBLGROUPS.GROUPID = tblInventoryGroups.GroupID)) ON (TBLINVENTORY.ITEMID = tblInventoryGroups.ItemID) AND (TBLINVENTORY.ITEMID = tblInventoryGroups.ItemID)) ON TBLMANUFACTURERS.MANUFID = TBLINVENTORY.MANUF) ON TBLSHIPTIME.ID = TBLINVENTORY.SHIPTIME) ON TBLINV_UNITS.ID = TBLINVENTORY.UNIT
WHERE (((TBLINVENTORY.SHOWIT)=-1))
ORDER BY TBLMANUFACTURERS.NAME, TBLGROUPS.NAME;


Thanks!

Reply With Quote
  #2  
Old June 1st, 2004, 04:49 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
SELECT TBLINVENTORY.*, TBLMANUFACTURERS.NAME AS ManufName, TBLMANUFACTURERS.DESCRIPAS ManufDesc,TBLGROUPS.GROUPID, TBLGROUPS.NAME AS GroupName, TBLSHIPTIME.SHIPTIME AS ShipTimeDesc, TBLSHIPTIME.IMG AS ShipTimeImg, TBLGROUPS.DESCRIP AS GroupDescrip, TBLINV_UNITS.UNIT AS UNITNAME
FROM TBLINV_UNITS RIGHT JOIN (TBLSHIPTIME RIGHT JOIN (TBLMANUFACTURERS INNER JOIN (TBLINVENTORY INNER JOIN (TBLGROUPS INNER JOIN tblInventoryGroups ON (TBLGROUPS.GROUPID = tblInventoryGroups.GroupID) AND (TBLGROUPS.GROUPID = tblInventoryGroups.GroupID)) ON (TBLINVENTORY.ITEMID = tblInventoryGroups.ItemID) AND (TBLINVENTORY.ITEMID = tblInventoryGroups.ItemID)) ON TBLMANUFACTURERS.MANUFID = TBLINVENTORY.MANUF) ON TBLSHIPTIME.ID = TBLINVENTORY.SHIPTIME) ON TBLINV_UNITS.ID = TBLINVENTORY.UNIT
WHERE (((TBLINVENTORY.SHOWIT)=-1))
ORDER BY TBLMANUFACTURERS.NAME, TBLGROUPS.NAME;

Reply With Quote
  #3  
Old June 1st, 2004, 05:06 PM
kila kila is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 90 kila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 33 m 59 sec
Reputation Power: 5
Bingo.

Well that worked (although you missed a space after TBLMANUFACTURERS.DESCRIP . I tried inserting "TBLMANUFACTURERS.DESCRIP AS MANUFDESCRIP, and for whatever reason it returned a 'not found in ordinal' error.

I've looked over your statement, am i missing another addition/change or can you tell me what might have gone wrong when i attempted it? (it seemed so simple, yet it screwed up)

Thanks.



Quote:
Originally Posted by sbaxter
SELECT TBLINVENTORY.*, TBLMANUFACTURERS.NAME AS ManufName, TBLMANUFACTURERS.DESCRIPAS ManufDesc,TBLGROUPS.GROUPID, TBLGROUPS.NAME AS GroupName, TBLSHIPTIME.SHIPTIME AS ShipTimeDesc, TBLSHIPTIME.IMG AS ShipTimeImg, TBLGROUPS.DESCRIP AS GroupDescrip, TBLINV_UNITS.UNIT AS UNITNAME
FROM TBLINV_UNITS RIGHT JOIN (TBLSHIPTIME RIGHT JOIN (TBLMANUFACTURERS INNER JOIN (TBLINVENTORY INNER JOIN (TBLGROUPS INNER JOIN tblInventoryGroups ON (TBLGROUPS.GROUPID = tblInventoryGroups.GroupID) AND (TBLGROUPS.GROUPID = tblInventoryGroups.GroupID)) ON (TBLINVENTORY.ITEMID = tblInventoryGroups.ItemID) AND (TBLINVENTORY.ITEMID = tblInventoryGroups.ItemID)) ON TBLMANUFACTURERS.MANUFID = TBLINVENTORY.MANUF) ON TBLSHIPTIME.ID = TBLINVENTORY.SHIPTIME) ON TBLINV_UNITS.ID = TBLINVENTORY.UNIT
WHERE (((TBLINVENTORY.SHOWIT)=-1))
ORDER BY TBLMANUFACTURERS.NAME, TBLGROUPS.NAME;

Reply With Quote
  #4  
Old June 1st, 2004, 05:36 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Are you sure TBLMANUFACTURERS.DESCRIP Exists???

That is the only thing I can think of that could be wrong

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Simple: Need to add a field to SQL query. (i'm terrible)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT