MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL 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 Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old June 11th, 2004, 12:36 PM
access_user access_user is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 13 access_user User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation SQL Syntax ???

I am not well versed in either sql or ms access and have been tasked with manipulating some canned queries that are provided with a software package we use. Here is my problem - I have opened the query in sql mode (in access 2002) and am confused by the syntax of how it is referencing a table name. (In addition, I also find that there is NOT the specified table in the database!) See Code Below:


SELECT BIB_TEXT.TITLE, [Item Location].Location,...

My questions are:

1) Why the [] around Item Location?
2) Where are they getting the fields for the table 'Item Location' when I can't even find the table in the DB?

Any and all help on this is appreciated. If more clarification is needed, just ask.

thanks-
Mike

Reply With Quote
  #2  
Old June 11th, 2004, 12:50 PM
Username=NULL Username=NULL is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: TX
Posts: 249 Username=NULL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 7 h 6 m 42 sec
Reputation Power: 5
Send a message via Yahoo to Username=NULL
1) B/c the table name is 2 seperate words...if you rename as "ItemLocation" the brackets are obselete, you can still use 'em w/1 word table/field names, but they're not needed.

2) just run a select on that table, if something pulls up, then the table exists. However, try this...sometimes Access acts kinda funny and won't show you all the tables when you initially view the Objects >> Tables tab. When you see the tables, click to view the queries or forms, then click back to view the tables, make sure the window is max'd, etc...see if that helps. One other thing to consider, perhaps there's a join to another DB, and that's where the table is coming from?? Not sure if the DB name needs to be included in the Select though, which would give me the answer w/out seeing the rest of the query.

Reply With Quote
  #3  
Old June 11th, 2004, 02:10 PM
access_user access_user is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 13 access_user User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
the rest of the query

hi null, here is the entire query-

SELECT BIB_TEXT.TITLE, [Item Location].Location, MFHD_MASTER.DISPLAY_CALL_NO, MFHD_MASTER.NORMALIZED_CALL_NO, MFHD_ITEM.ITEM_ENUM, MFHD_ITEM.CHRON, [Item Location].HISTORICAL_BROWSES
FROM (((BIB_TEXT INNER JOIN BIB_MFHD ON BIB_TEXT.BIB_ID = BIB_MFHD.BIB_ID) INNER JOIN MFHD_ITEM ON BIB_MFHD.MFHD_ID = MFHD_ITEM.MFHD_ID) INNER JOIN [Item Location] ON MFHD_ITEM.ITEM_ID = [Item Location].ITEM_ID) INNER JOIN MFHD_MASTER ON BIB_MFHD.MFHD_ID = MFHD_MASTER.MFHD_ID
WHERE ((([Item Location].HISTORICAL_BROWSES)>=[Minimum Browse]));

There is only one DB and it does return values from both the Location and HISTORICAL_BROWSES fields of the 'Item Location' table. Any ideas??

Thnx-

Reply With Quote
  #4  
Old June 11th, 2004, 02:42 PM
Username=NULL Username=NULL is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: TX
Posts: 249 Username=NULL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 7 h 6 m 42 sec
Reputation Power: 5
Send a message via Yahoo to Username=NULL
well then the table has to be in there, else it would throw an error. When you view the tables, is the window maximized?...if a scroll bar is present you've scrolled the entire length? Very weird if you can't find it.

Btw, welcome to the forums...one tip, if you ever need to post a query, or other code...use the CODE tags and you can format your code better, I usually do my query in notepad and just paste...
Code:
SELECT	BIB_TEXT.TITLE,
	[Item Location].Location,
	MFHD_MASTER.DISPLAY_CALL_NO,
	MFHD_MASTER.NORMALIZED_CALL_NO,
	MFHD_ITEM.ITEM_ENUM,
	MFHD_ITEM.CHRON,
	[Item Location].HISTORICAL_BROWSES
FROM	(((BIB_TEXT
INNER	JOIN BIB_MFHD
	ON BIB_TEXT.BIB_ID = BIB_MFHD.BIB_ID)
INNER	JOIN MFHD_ITEM
	ON BIB_MFHD.MFHD_ID = MFHD_ITEM.MFHD_ID)
INNER	JOIN [Item Location]
	ON MFHD_ITEM.ITEM_ID = [Item Location].ITEM_ID)
INNER	JOIN MFHD_MASTER
	ON BIB_MFHD.MFHD_ID = MFHD_MASTER.MFHD_ID
WHERE	((([Item Location].HISTORICAL_BROWSES) >= [Minimum Browse]));

Reply With Quote
  #5  
Old June 11th, 2004, 03:44 PM
access_user access_user is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 13 access_user User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thnx Null, I'll keep the code tip in mind. No luck on finding the table but I thank you for your input. Will keep poking around or perhaps will add another table to the query that I know contains the info I need (and in the format I need it to be in) and save myself the trouble of hunting out this elusive "Item Location" table.



Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > SQL Syntax ???


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 3 hosted by Hostway