|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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- |
|
#4
|
|||
|
|||
|
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])); |
|
#5
|
|||
|
|||
|
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.
![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > SQL Syntax ??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|