Column in field list is ambiguous error

i am using jdbc in my program with a query statement that retrieve holdingsID by querying different tables. when i run the program it has an error saying
Column HoldingsID in field list is ambiguous, what does this mean? How can i solve it?
here is my code, included is my sql select statement please check it.
        String key=request.getParameter("key");  
          Connection conn = null;
          String[][] a=new String[10][3];          
          int r=0;
          String qstr="";
          ResultSet rs=null;          
          try{     
          Class.forName("com.mysql.jdbc.Driver").newInstance();
          conn = DriverManager.getConnection("jdbc:mysql://localhost/scitemp?user=scinetadmin&password=A1kl@taN");
          Statement stmt=conn.createStatement();
            qstr="SELECT DISTINCT HoldingsID FROM tblHoldings, tblHoldingsAuthorName," +
                     "tblHoldingsSubject, tblHoldingsPublisherName"+
                  " WHERE (tblHoldings.Title LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR "+
                 "(tblHoldings.Contents LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
                 "(tblHoldingsAuthorName.AuthorName LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
                "(tblHoldingsSubject.SubjectHeadings LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
               "(tblHoldingsPublisherName.PublicationDate = "+"'"+key+"'"+")"+
                     " ORDER BY HoldingsID";                              
          rs  = stmt.executeQuery(qstr);
          while ( rs.next() && r <10) {                     
                    a[r][0]=rs.getString("HoldingsID");     
                    a[r][1]="1";
                    a[r][2]="SILMS";  
                    r++;      
          }catch(Exception e){out.println("error:"+e.getMessage());}-----
thanks in advance for your help

Actually, this is probably going to be a bit more efficient on large scale data. (I'm guessing, if it matters then test...)
SELECT DISTINCT HoldingsID FROM
  SELECT HoldingsID
  FROM tblHoldings
  WHERE tblHoldings.Title LIKE '%key%'
       OR tblHoldings.Contents LIKE '%key%'
UNION ALL
  SELECT HoldingsID
  FROM tblHoldingsAuthorName
  WHERE tblHoldingsAuthorName.AuthorName LIKE '%key%'
UNION ALL
  SELECT HoldingsID
  FROM tblHoldingsSubject
  WHERE tblHoldingsSubject.SubjectHeadings LIKE  '%key%'
UNION ALL
  SELECT HoldingsID
  FROM tblHoldingsPublisherName
  WHERE tblHoldingsPublisherName.PublicationDate = 'key'
ORDER BY HoldingsIDThe diffence is when the sort(s) to create distinct rows is done. In the first version, UNION must produce only distinct values, so three sorts must be performed, one to create each UNION intermediate result. In the 2nd version, UNION ALL doesn't produce
distinct values, we delay the sorting until the last minute and sort all candidates once, instead of one sub-set once, one sub-set twice and two sub-sets 3 times. If this is a school project, the difference probably doesn't matter.
By the way, many databases implement the DISTINCT keyword in such a way that it creates sorted result sets, sorted by the resulting column values. As far as I know, this is not guaranteed by the SQL standard, so the additional ORDER BY clause is still needed for rigourous portability to databases that don't work that way. If that's not a concern and speed is, in many situations you can drop the ORDER BY; however for small result sets the difference is nearly invisible, and even for moderately large result sets, sorting an already sorted result set is usually an Order(n) in-memory operation. For really big results, the database will be swapping results to disk as it sorts and this sort of optimization matters then. This also applies to the use of GROUP BY.

Similar Messages

  • Unknown column 'NewMessages' in 'field list'

    Hi,
    I am using PHP MySQL.
    Ok, I am pretty sure my Hosting service upgraded either phpmyadmin, php, mysql, or all three because they are slightly different than before. So this code:
    $colname_NewMessages = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_NewMessages = $_SESSION['MM_Username'];
    mysql_select_db($database_ProfileID, $ProfileID);
    $query_NewMessages = sprintf("SELECT * FROM Message_System WHERE Reciever = %s AND Status = 'Not_Read' ", GetSQLValueString($colname_NewMessages, "text"));
    $NewMessages = mysql_query($query_NewMessages, $ProfileID) or die(mysql_error());
    $row_NewMessages = mysql_fetch_assoc($NewMessages);
    $totalRows_NewMessages = mysql_num_rows($NewMessages);
    use to work fine, but now it is returning the error "Unknown column 'NewMessages' in 'field list'"!
    Can anyone help me with this?
    Thanks

    Use echo to see the actual query that's being sent to the database:
    $colname_NewMessages = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_NewMessages = $_SESSION['MM_Username'];
    mysql_select_db($database_ProfileID, $ProfileID);
    $query_NewMessages = sprintf("SELECT * FROM Message_System
                                  WHERE Reciever = %s
                                  AND Status = 'Not_Read' ",
           GetSQLValueString($colname_NewMessages, "text"));
    echo $query_NewMessages;
    exit;
    $NewMessages = mysql_query($query_NewMessages, $ProfileID) or die(mysql_error());
    $row_NewMessages = mysql_fetch_assoc($NewMessages);
    $totalRows_NewMessages = mysql_num_rows($NewMessages);

  • Problem with a field list.

    Hi people,
    When I check the code of my program the system tell me that:
    Unknown column name "TITLE_MEDI". not determined until runtime, you cannot specify a field list.          
    but the thing is that the table TSAD3 have this field and I dont know what the system tell me this.      
    Thanks for the help.

    Hi Please Check the field is Activated or Not in the Database.
    But in our Table We can see only TITLE field. ,may be that is the reason.
    check it once.
    please paste your code where it shows error.
    regards
    vijay

  • Sharepoint list dataheet view error "Cannot connect to the server at this time. You can continue working with this list, but some data may not be available"

    I have a List which is having around 14000 items in it.while opening that list in datasheet view it is giving error .
    Below is a summary of the issue:
    After selecting datasheet view beow error occurs:
        "Cannot connect to the server at this time.  You can continue working with this list, but some data may not be available."
        "Unable to retrieve all data."
        The item counts displays say 100 out of 14000 items.
    Exporting List to excel is giving only 2000 records out of 14000 records.
    Other Observations   -  
    This is happening to only one list on the site .There are other lists in the site whose no. of records is equal to 8000 to 9000.They are working absolutely fine without any error.
    Also, If I am saving this list as a template and creating another list with it ,then it is working absolutely fine with 14000 records,so the issue does not seem to be related with no. of records as the template list is working fine.
    I have checked the Alternate access mapping setting ,its fine.
    It should not be related to lookup,datefield or any other column as the list created from it template is working fine with all these columns.
    I checked below links also ,but doesn't seem to work in my case.
    http://social.technet.microsoft.com/forums/en-US/sharepointadminprevious/thread/974b9168-f548-409b-a7f9-a79b9fdd4c50/
    http://social.technet.microsoft.com/Forums/en-US/smallbusinessserver/thread/87077dd8-a329-48e8-b42d-d0a8bf87b082
    http://social.msdn.microsoft.com/Forums/en-US/sharepointgeneral/thread/dc757598-f670-4229-9f8a-07656346b9b0

    I have spent two days to resolve this issue. Microsoft has released two KBs with reference to this issue...but are not appearing in search results at the top.
    I am sharing my finding.
    1. First install the
    KB2552989 (Hopefully you might have already installed it. The KB detetcts it and informs the user.)
    2. Then update registry by adding new key for data fetch timeout as mentioned inKB2553007
    These two steps resolved the issue in our environment. Hope it might help others as well.
    Pradip T. ------------- MCTS(SharePoint 2010/Web)|MCPD(Web Development) https://www.mcpvirtualbusinesscard.com/VBCServer/paddytakate/profile

  • Reference to class List is ambiguous

    Hello,
    I've started to make my first java program in which I use AWT.
    When I compile the file, it gave me this error:
    "reference to List is ambiguous, both class java.awt.List in java.awt and class java.util.List in java.util match"
    So I use some tools from the java library: java.util ( f.e. arrays)
    and I use of course the library: java.awt
    Now when I try to make a list:
    f.e.
    List data = new List(10,false);
    The program doesn't know if I want to use the method List, from AWT or UTIL
    In fact, I want to use this from AWT.
    How can I make that clear.
    Thx

    It will probably work if you add "import java.awt.List;" to your imports. If that doesn't do it, you will need to specify which List when you declare or instantiate it. For example, if you now have
    List list = new List(10,false);
    Then change it to
    java.awt.List list = new java.awt.List(10,false);

  • Creating a new Column for my list Versus adding it from existing site columns, when to use each approach

    I have created a new issue tracking list inside SharePoint 2013 team site. And it comes with predefined columns, some of them are useful while the other are not . Can anyone help me in figuring out the following:-
    The list come with a field named “Assigned To”, while in my case I want a column named “Approver”. So what is preferred , to re-name the “Assumed to ”column to “Approver”, or create new field name “Approver”.?.
    If I rename an existing column, could this be overridden in any future updates for my SharePoint server?
    Now we want to add a column named “Office location”.so I need to create a new field for this. But seems there are two ways to do so either to add a new Site Column at the site level and then assign it to the list as follow :- 
    , or to directly adding a column to the list, even if it is not available in the site columns , as follow:-
    So what are the differences between the two approaches ? .if I am not wrong defining a site column will allow me to re-use it in another list , but defining the column at the list level, will allow me to add a column even if it is already defined as site
    column.
    So can anyone advice on my three questions please? Thanks

    1) 'Assigned to' has a different meaning then 'Approver' , it will be better if you create a new field for 'Approver'. Assigned to is a Site Column which has managed property for search, so it will be confusing type of data it will return from search in
    future. 
    2) Any rename of fields should not / and will not get modified in SharePoint updates. So, you can rename is without any issue since the internal name will remain the same. But its always better to create your own custom column for business use.
    3) Creating a site column or not depends upon your need, If you create a Site Column - in whole site collection you will be able to add this field in any list - It will be crawled, SharePoint will automatically provide managed property for site column and
    you will be able to get this value via search. These things will not be present in list column, you will need to do specific settings in case its required.
    If these things are needed then you can go for Site Column, usually its good to create a Site Column and use it.
    For Site Columns you can check following links 
    Introduction to Columns
    From site column to managed property - What's up with that?
    Create a site column
    get2pallav
    Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.
    thanks a lot for your reply it is really helpful. so as i understand that using site columns will be better in most cases, and there is not any specific reason for not using it? is this right ?
    Second question, do u mean that if i have a list column named "Serial number", then this column will not be searched ? For example if i have serial number such as "12345" and i try searching this text "12345" i will not get
    the item in my search ?
    Thanks

  • Field cost centre is a required field for GL account Error

    The error that I get during a sales transaction is: Field cost centre is a required field for GL account Error. Where or which transaction in FI do I use to maintain this setting.
    Thank you.

    Hi,
    Goto Tcode - OKB9. Search for that G/L account number under your co. code. There select the row, you can maintain the cost center directly. Else for Account assignment detail column, keep it as 1(Valuation area mandatory). Then under new entries maintain the valuation area, which is nothing but the plant, and against that maintain the cost center.
    Hope this resolves your query.
    Please let me know if you need any additional information.
    Thanks,
    Prithwiraj.

  • How to create Remainder email workflow in share point 2010 designer without creating the remainder date (calculated) column in the list

    Hi,<o:p></o:p>
    I have task to create remainder email notification 3 days before by comparing with End
    date (my list item) so i created one calculated column in the list as remainder date by using that remainder date
    i created, but my project manager told me create same remainder notification work flow without create that remainder date i tried to write calculation in work flow
    but it is not working if any one knows how to do this please help me<o:p></o:p>
    Thanking you,<o:p></o:p>
    ArunDarly <o:p></o:p>

    Hi,
    For reminder type requirements, I tend to use the ‘Information Management Policy’ SPD method as described in
    this blog article by Laura Rogers (it’s for MOSS and WSS but works in SP2010 also).
    This method avoids the use of calculated columns; rather the workflow does the calculation and outputs information into a ‘reminder’ field. Also, I don’t like the idea of ‘paused workflows’, so this method works for me.
    Cheers
    Matt

  • Hide a column in Abap List

    Hi,
    I build a query in sq01.
    This is a statistic report, with an integer field named "AGE" which I marked to show the average too.
    I want to show the output in ABAP List (not ALV).
    The problem is that I want to show ONLY the average column (of the AGE), WITHOUT the AGE column.
    Can I hide this column in ABAP List?
    Thanks
    Itzhak.

    Hi Itzhak,
    well I don't know what you mean by hiding. Once you created a output list just with ABAP write command, there is no way to 'hide' a column. But you can add a parameter or any other criteria to the program and do the write statement for that field depending on this criteria.
    Hope this helps
    regards
    Siggi

  • Powerpivot pivottable - I can't add or drag a "value field" from the pivottable field list into the "values" section.

    I built a pivottable using Powerpivot.
    Initially, I can add or drag any data field I want to columns, Rows or the Values area inside the field list (those 4 squares). However, as times goes by...suddenly... I just no longer can add or drag a "value field" from the pivottable field list into the
    "values" section. 
    Does anybody know how to fix this problem ?

    Hi Bin Long,
    I tried what you suggested.
    I believe that there is a glitch in the Powerpivot field list (where you find the 4 squares for columns, rows, values, filter)
    When I initially create a pivottable with powerpivot, everything works fine when I am adding field list items to the the columns, rows, values sections, filters.
    However.....IF I close the powerpivot field list or if I save and close the excel file...then I cannot add more items to the "values" section.
    I can comment about one thing that seems different in my powerpivot field list. When I can no longer add items to the "values" section, I realized that in the TOP section of the field list I see in bold letters a summary of the items that are SUM ∑ in the "values"
    section.
    Does anybody know how to fix this ?
    Thanks.

  • BCS and a Lookup column in another list pointing to the BCS

    Hi,
    SP 2010 Server.
    Say I create a BCS to a line of business database with one Table named Customers.
    Customers has an ID column and FullName column.
    I create from this BCS an external list created in SP (say ExternalCustomers).
    I create a standard SP List named InternalCustomers.
    That list has a lookup field named CustomerName that is a lookup to the FullName column of the BCS ExternalCustomers list.
    Is this possible? When the user chooses the FullName in the InternalCustomers list is he presented with a choice of fullnames from the ExternalCustomers list?
    I am confused because of this statement from
    here
    11) Not everything from Lookups
    Unfortunately the only thing that you can do a look up on in an external list is on the ID column, anything else and you are out of luck.
    Thanks,
    Maz
    Maz

    Hi,
    According to your description, my understanding is that you want to look up External Data in the Customer list.
    I suggest you can add the "External Data" column in the list to access the external content type to look up the field you need.
    Here is a detailed article for your reference:
    How to: Create a SharePoint List with External Data Columns
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Field ZZBUDAT is delta-relevant, but does not exist in the field list

    Hi All,
    I have created a Generic DataSource on a View.Now there is a situation ,i need to add a Date field form some other table.
    So i have enhanced the datasource now that date is coming in my datasource.
    But when i tried to make delta on that date field its showing error-
    Field ZZBUDAT is delta-relevant, but does not exist in the field list
    Message no. R8279
    Diagnosis
    The DataSource uses field ZZBUDAT for specifying the delta. In the DataSource field list, however, the field does not occur
    Now how i can make this field dalta relevant?
    Thanks,
    Piyush

    Piyush,
    I think the message in SAP is quite clear....
    If the field ZZBUDAT does not exist in the view ... how do you expect the datasource to know which records have changed...?
    The delta relevant field SHOULD be in the view - else there is no way the extractor can identify the changed records ...
    Please remember that the Generic extractor is a simple select statement with a where clause on the delta relevant field and nothing else ... if you want the changed on field to come from another table - then you need to write a function module extractor to do this...
    The order of processing is that - the view fields are processed first - then the enhanced fields are processed followed by the user exits...

  • Add custom column in default list view in sharepoint

    Hello,
    How to add custom column in default list view in SharePoint 2013? In list view we have view fields section. But its not allowing to add any static text.  I want to add one button/textin view fields. How to add that?
    <View Name="{C7499466-A865-4742-8511-5536D2521D1C}" MobileView="TRUE" Type="HTML" Hidden="TRUE" DisplayName="All Documents" Url="/SectionManagement/SitePages/Untitled_1.aspx" Level="1"
    BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/dlicon.png?rev=23" ><Query/>
    <ViewFields>
    <FieldRef Name="LinkFilename"/>
    <FieldRef Name="LinkFilenameNoMenu"/>
    </ViewFields>

    Hi,
    to add a field to a view use this
    <ViewFields>
    <FieldRef Name="LinkFilename"/>
    <FieldRef Name="LinkFilenameNoMenu"/>
    <FieldRef Name=[InternalNameOfCustomField]/>
    </ViewFields>

  • COUNT field incorrect or syntax error while installing BO Xi3

    Hello
    I am trying to install Boxi3. The cms and audit dbs are all in sql database. The dbs and accounts are setup properly. However while installing, after I selected the CMS and Audit DBs, I am getting
    "Database access error. Reason [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error."
    At the details the error is as below.
    Wed Jul 30 03:46:53 2008]     5220     192     trace message: loading libary succeeded
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::Init()
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: initializing subsystem succeeded
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::Connect()
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\DBConnectionManager.cpp:802): trace message: DBConnectionManager - Setting total target number of connections for pool 0 to 1.
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM APPLICATION_TYPE WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM AUDIT_EVENT WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM EVENT_TYPE WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM SERVER_PROCESS WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM AUDIT_DETAIL WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM DETAIL_TYPE WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::CheckDBCredentials()
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\AuditDatabaseSubsystem_impl.cpp:1197): trace message: AuditDatabaseSubsystem::CheckDBCredentialsOnTable(AUDIT_EVENT)
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerDatabase.cpp:515). (0 : Unexpected database column type for Duration type is decimal).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerDatabase.cpp:515). (0 : Unexpected database column type for Event_Type_ID type is decimal).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerDatabase.cpp:515). (0 : Unexpected database column type for Error_Code type is decimal).
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:162): trace message: Prepare: SQL: INSERT INTO AUDIT_EVENT (Duration, Error_Code, Event_ID, Event_Type_ID, Object_CUID, Server_CUID, Start_Timestamp, User_Name) VALUES(?, ?, ?, ?, ?, ?, ?, ?)
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerStatement.cpp:699). (0 : Unsupported SQL Server data type for binding.).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerStatement.cpp:699). (0 : Unsupported SQL Server data type for binding.).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerStatement.cpp:699). (0 : Unsupported SQL Server data type for binding.).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\AuditDatabaseSubsystem_impl.cpp:1344). (0 : no message).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\AuditDatabaseSubsystem_impl.cpp:1344). (0 : no message).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\AuditDatabaseSubsystem_impl.cpp:1344). (0 : no message).
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:171): trace message: Prepared statement Execute
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerDatabase.cpp:119): trace message: SQLServer error found:  ErrorMessage([Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error), ErrorCode(0)
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\AuditDatabaseSubsystem_impl.cpp:92): trace message: DBConnectionHolder - (AuditDB) - Caught retryable error with Code 0, Msg: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error  Number of retryable errors on this connection is 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\dbutils.cpp:922): trace message: Caught DatabaseSubystem Error: Database access error. Reason [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error.
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::Shutdown()
    This only happens for audit db and not for cms db. May I know what is the reason for this and how to resolve it?
    Thanks

    I am using Java 6 already.That's what I said in my last post.
    setClob() and setCharacterStream() are used for
    NVARCHAR and NTEXT tyesLike I said, the API talks about using setCharacterStream for LONGVARCHAR types, are NVARCHAR and NTEXT LONGVARCHAR types?

  • Power Pivot Slicer options not showing in the Pivot Table Field list

    Excel 2013. In all the tutorials I watch when you create a Pivot Table using Power Pivot there are Slicer options in the
    Pivot Table Fields list.  Slicer Horizontal, Slicer Vertical These do not show for me.   I see Filters, Value, Row, Column only.   Is there a setting I need to turn on?   When I click on PowerPivot
    at the top, the first icon on the bar is Manage Data model, not Powerpivot as I have seen on some of the youtube tutorials.   Thank you in advance.

    Thank you for trying but it's not what I am after.  I understand how to use Slicers with pivot tables.   My question relates to Pivot Tables created using PowerPivot.   Directly under the Pivot Fields list on the right is a section where
    you choose what you want to pivot  i.e  Filters, Values, Rows, Columns.   These are standard with any pivot table.  When I watch videos on PowerPivot there are 2 additional options in the section.  Slicer Vertical, Slicers Horizontal.
     The video comments  they only show in when creating a pivot table using PowerPivot.  These 2 options are not there for me.  I don't know why. It maybe the version of office I am using which is Microsoft Office Plus 2013. I'd like them
    included.  Appreciate you taking the time to help.  

Maybe you are looking for