MySQL query not outputting results

Hi Guys,
I want to retrieve a record from my database which has the latest date and output its contents onto the webpage. This is what I have done so far:
ResultSet rs = DB.exQuery("SELECT max(transaction_date) as 'lastest_date',transaction_value,transaction_type"
                              + "FROM transaction_log WHERE user_id =" + user.getId() + " AND is_credit = '1'");
try {
     trans_date = rs.getString("lastest_date");
     credit = rs.getString("transaction_value");
     trans_method = rs.getString("transaction_type");
} catch(SQLException ex) {}It compiles fine but when I run the servlet I get "java.lang.NullPointerException" on line 92 (+trans_date = rs.getString("lastest_date");+). I get the same error even if I add the rs.next() method. Note that the database will always only output ONE record. I checked the MySQL query (ran it on the server directly) and it worked fine.

try {
ResultSet rs = DB.exQuery("SELECT max(transaction_date) as lastest_date, transaction_value,transaction_type"
                              + "FROM transaction_log WHERE user_id =" + user.getId() + " AND is_credit = '1'");
if ( rs.next () ) {can you explain
*     trans_date = rs.getString("lastest_date");* // trans_date is a string type or date type... and max(transaction_date) as lastest_date returns which type...
     credit = rs.getString("transaction_value");
     trans_method = rs.getString("transaction_type");
} catch(SQLException ex) {}

Similar Messages

  • Execute query  not give result

    Hi master
    Sir lets suppose I have emp form and I put under blow code in when button press event
    When_Button_press
    go_block('emp');
    enter_query;
    :emp.deptno := 10;
    execute_query;
    but
    when I press button then no result no data in any field and curser present in first column or form.
    It is my idea the execute query are not run or these command are not run
    :emp.deptno := 10;
    execute_query;
    system not replace data and no run execute_query
    please give me idea
    Thanking you
    Muhammad Fahim Aamir

    Hi master
    Sir when I use this code with numeric data work fine
    DECLARE
         DD VARCHAR2(15);
    BEGIN
         DD:=10;
    set_block_property('emp', default_where, 'where
    DEPTNO='||DD);
    go_block('emp');
    execute_query;
    set_block_property('emp', default_where, '');
    END;
    But When use with string data then not give result I
    press f8 and show all record
    With character not give any result
    DECLARE
         DD VARCHAR2(15);
    BEGIN
         DD:='SALESMAN';
    set_block_property('emp', default_where, 'where
    RTRIM(EMPNO)='||DD);
    go_block('emp');
    execute_query;
    set_block_property('emp', default_where, '');
    END;
    Please give me any ideaYour problem is in your where clause you do not put the word where in the where clause as it is assumed
    I usually declare a variable v_where VARCHAR2(200);
    and then assign it my new where clause
    v_where := ' RTRIM(EMPNO)='||DD;
    GO_BLOCK ('emp');
    SET_BLOCK_PROPERTY('emp',default_where, v_where);
    EXECUTE_QUERY;
    v_where := null; ---clean up
    This allows you to easily put your where clause into a message
    message(v_where);
    so you can see what is really being queried. This is very useful when you are using multiple values to make sure you have all the apostrophes that you need
    eg: v_where := v_where := 'item_type <> ''CAT'''||' and user_id = '''||:login.user_id||'''';

  • BEX Query not dispaying results

    Hi All,
    I think this week am hit with number of issues....as mentioned in my earlier posts am new to SAP BW and having issues.
    Issue:
    We have a BEx query and it is not displaying results(in Web report). Error is "could not find any records for the given selection......... "
    I have checked the Infocube for the given selection in Query and I can display the records where as it is not displaying at all in BEx query results.
    I have reactivated the cube to see whether the data flows through but it didn't work.
    I tried executing query using RSRT and it is not displaying any results.
    I have deleted data in the infocube and loaded it again and it didn't work
    Any help would be much appreciated.
    Cheers
    Sandeep

    Hi Akshay,
    No errors while executing query under RSRT.
    Yes we are using time variants and we have included fical variant under characteristic restrictions.
    Cheers
    sandeep

  • Mysql query not getting all the results, works fine in php

    Hi All,
    I have a slightly big query which works fine in php getting 400 results but in java I get only 14 results when I traverse through resultset. Here is the query
    (select t1.to_uri as inv_to_uri, t1.sip_to as inv_sip_to, t1.sip_callid as inv_callid, t1.time as inv_time, t1.fromtag as inv_fromtag, t1.sip_status as inv_status, t2.to_uri as bye_to_uri, t2.sip_to as bye_sip_to, t2.sip_callid as bye_callid, t2.time as bye_time, t2.fromtag as bye_fromtag, t2.totag as bye_totag, t2.from_uri as bye_from_uri, t2.sip_from as bye_sip_from, sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length, ifnull(t1.time, t2.time) as ttime , 'outgoing' as call_type from acc t1 left outer join acc t2 on t1.sip_callid=t2.sip_callid and ((t1.totag=t2.totag and t1.fromtag=t2.fromtag) or (t1.totag=t2.fromtag and t1.fromtag=t2.totag)) and t2.sip_method='BYE' where t1.sip_method='INVITE' and (t1.username='manoj' and t1.domain='mantragroup.com') and t1.caller_deleted != '1' ) union (select t1.to_uri as inv_to_uri, t1.sip_to as inv_sip_to, t1.sip_callid as inv_callid, t1.time as inv_time, t1.fromtag as inv_fromtag, t1.sip_status as inv_status, t2.to_uri as bye_to_uri, t2.sip_to as bye_sip_to, t2.sip_callid as bye_callid, t2.time as bye_time, t2.fromtag as bye_fromtag, t2.totag as bye_totag, t2.from_uri as bye_from_uri, t2.sip_from as bye_sip_from, sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length, ifnull(t1.time, t2.time) as ttime , 'outgoing' as call_type from acc t1 right outer join acc t2 on t1.sip_callid=t2.sip_callid and ((t1.totag=t2.totag and t1.fromtag=t2.fromtag) or (t1.totag=t2.fromtag and t1.fromtag=t2.totag)) and t1.sip_method='INVITE' where t2.sip_method='BYE' and isnull(t1.username) and (t2.username='manoj' and t2.domain='mantragroup.com') and t2.callee_deleted != '1' ) order by ttime DESC limit 100,50
    Also this queru works fine on mysql console getting all 400 results. Please tell me what might be going wrong in Java.
    Thanks for your help and time,
    Manoj.

    How do you know you're doing the same query in PHP, MySQL, and the console?
    What's the code that's executing this?
    There's nothing intrinsically wrong with the query, although it's a bit messy - surely it could be simplified from that?
    Please format queries before posting in future. Also, did you really mean to let us know your company name and the name of a user? Seems a bit indiscrete.
         select
            t1.to_uri as inv_to_uri,
            t1.sip_to as inv_sip_to,
            t1.sip_callid as inv_callid,
            t1.time as inv_time,
            t1.fromtag as inv_fromtag,
            t1.sip_status as inv_status,
            t2.to_uri as bye_to_uri,
            t2.sip_to as bye_sip_to,
            t2.sip_callid as bye_callid,
            t2.time as bye_time,
            t2.fromtag as bye_fromtag,
            t2.totag as bye_totag,
            t2.from_uri as bye_from_uri,
            t2.sip_from as bye_sip_from,
            sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length,
            ifnull(t1.time, t2.time) as ttime ,
            'outgoing' as call_type
         from
            acc t1
         left outer join
            acc t2
         on
            t1.sip_callid=t2.sip_callid
         and
            (  (t1.totag=t2.totag and t1.fromtag=t2.fromtag)
            or (t1.totag=t2.fromtag and t1.fromtag=t2.totag))
         and
            t2.sip_method='BYE'
         where
            t1.sip_method='INVITE'
         and
            (t1.username='manoj' and t1.domain='mantragroup.com') and t1.caller_deleted != '1'
    union
         select
            t1.to_uri as inv_to_uri,
            t1.sip_to as inv_sip_to,
            t1.sip_callid as inv_callid,
            t1.time as inv_time,
            t1.fromtag as inv_fromtag,
            t1.sip_status as inv_status,
            t2.to_uri as bye_to_uri,
            t2.sip_to as bye_sip_to,
            t2.sip_callid as bye_callid,
            t2.time as bye_time,
            t2.fromtag as bye_fromtag,
            t2.totag as bye_totag,
            t2.from_uri as bye_from_uri,
            t2.sip_from as bye_sip_from,
            sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length,
            ifnull(t1.time, t2.time) as ttime ,
            'outgoing' as call_type
         from
            acc t1
         right outer join
            acc t2
         on
            t1.sip_callid=t2.sip_callid
         and
            (  (t1.totag=t2.totag and t1.fromtag=t2.fromtag)
            or (t1.totag=t2.fromtag and t1.fromtag=t2.totag))
         and
            t1.sip_method='INVITE'
         where
            t2.sip_method='BYE'
         and
            isnull(t1.username)
         and
            (t2.username='manoj' and t2.domain='mantragroup.com')
         and
            t2.callee_deleted != '1'
    order by ttime DESC limit 100,50

  • QUERY NOT SHOWING RESULTS

    Hi Experts ,
    iam facing issue with one the quey, the query has built on cube and it is restricted based on calday, when iam exwecuting the query the below message is coming.
    "Warning Aggrehate cannot be used ,as 0REQUID IS IN DRILLDOWN
    wARNING mAXIMUM number of rows(65535) ecxeeded.Result is in complete."
    and when i click on cancel button the below messahe is coming .
    ""There is not enough sapce to dispaly all the rows of query result" and in cube the records are only 50,000.
    So could any one let me know what are the possible reasons for this issue and how i rectify this issue.
    when i checked in RSRT it leads to short dump "SYSTEM_NO_ROLL"
    Error analysis
        More main memory area was requested.
        However, all the available space has been used up.
        Possible reasons:
        - Many (large) internal tables.
        - Many (large) programs active.
        - Deep nesting of subroutines with a lot of local data.
    Please give me the appropriate resolution for the same.
    Thanks in advance,
    Madhu.

    Hi Madhu
    Are on BW 3.5 or Bi7?
    Please check your query definition if you have  0REQUID in Row /Colums/ or Filter tab.
    First of all this error message is saying that your query is not using aggregates because of some reason, may be 0REQUID is present the query definition.
    Secondly, when you run the query from RSRT open another session in use transaction code SM50 to know what the query is reading. May be your Cube contains too much of data for which system can not provide enough memory area.
    You can also look at the below notes if you are on SAP BW 3.5 system..
    https://service.sap.com/sap/support/notes/842495
    https://service.sap.com/sap/support/notes/1085471
    Regards
    Anindya

  • Query Not Showing result

    Hi all,
    I am having one query which i have included into Workbook. and query is based on purely Zee datasource and Zee infoprovider.
    While refreshing my workbook it is not brining any result. but cube has reporting status available. I have tried all option like copy, again trasport etc but still not working. One thing if i have run without structure means free selection then it is brining the result. I m not understading why it is happening like this.
    I am in BI Prod server.
    please revert back.
    amit shetye.

    Structures have restrictions check this:
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm

  • Query not fetching results and shows executing

    All,
    When I run a query from SQL Plus I am getting query results immediately table with more than 50,000 rows), but when I run from TOAD or PL/SQL Developer am not getting any result and all I see is query executing no error message also.
    Surprising part is I am able to see results if the table is less than 100 rows in SQL Plus, TOAD and PL/SQL Developer.
    Please tell me is there anything I have to do in the database configuration, I am facing this issue due to database move to a new server.
    Thanks in advance

    Anand,
    I don't see this as an issue with TOAD or PL/SQL Developer, the reason is using my TOAD or PL/SQL Developer I am able to connect to the copy of this database (DEV) and able to fetch results. Only in the database I migrated to the new server I am not able to fetch results from connecting through any application, the only place I am able to run and get results is SQL PLUS.
    So I believe this is something which I am missing in my database configuration or in my new server.
    Please help me
    Thanks in Advance

  • Query not showing result  for 1st column

    dear all,
    i want to show the result row for my query for the 1st column...
    e.g. i have column cost center, po number and vendor both po number and vendor will show the result column but not cost center.. any idea why?
    here are my bex settings for cost center
    supression = never, normalization = no normalization.

    Hello -
    You check for costcenter data in the data targets, for the given PO and vendors,.
    If data exists then it should be available in the reports,.
    Else it won't .
    Regards,
    Vishwa

  • Unoin all Query not showing result

    I write the query with sub query
    query 1 has no any record
    query 2 has one record
    I do query 2 - query 1 (qty)
    display nothing??
    select null doc_type,
            null docno,
            null docdate,
            qry1.itemcode,
            qry1.itemname,
            null party,
            null itemunit,
      nvl(qry2.Inqty,0) - nvl(qry1.outqty,0) qty
          from (                                           --------- Query 1 for Check Out Quantity ----
                                                select itemcode,itemname,sum(qty) OUTQTY from smd
                                           where (doc_type ='SAO'or doc_type = 'D.C')
                                            and (docdate < :dd1)
                                            group by itemcode,itemname) qry1,
                                                        ------------Query 2 for check In Quantity ----
                                              (select itemcode,itemname,sum(qty) inqty from
                                            (select itemcode, itemname,qty from smd where doc_type ='OPN'
                                            union all
                                            select b.itemcode, b.itemname,sum(nvl(b.qty,0)) qty from smd b
                                            where (doc_type ='SAI' or doc_type = 'MRN')
                                            and (docdate <= :dd1)
                                            group by b.itemcode, b.itemname)
                                            group by itemcode,itemname                              
                                            ) qry2                                         
                                            ----------- to check the conditions ---------                                                                      
                                            where qry1.itemcode = qry2.itemcode (+)
                                            and qry2.itemcode between :itm1 and :itm2     
    Results of both sub query
    Qry1 =itemcode = null, itemname = null, outqty = null ( has no any record)
    qry2 = Itemcode = 0010002 , itemname = Computer , inqty =100why nvl(qry2.Inqty,0) - nvl(qry1.outqty,0) qty not working
    What is wrong in this query

    Thank you experts
    I try but showing error
    select null doc_type,
            null docno,
            null docdate,
            qry1.itemcode,
            qry1.itemname,
            null party,
            null itemunit,
      nvl(qry2.Inqty,0) - nvl(qry1.outqty,0) qty
      from (                                           --------- Query 1 for Check Out Quantity ----
                                                select itemcode,itemname,sum(qty) OUTQTY from smd
                                           where (doc_type ='SAO'or doc_type = 'D.C')
                                            and (docdate < :dd1)
                                            group by itemcode,itemname) qry1
                                               full outer join
                                                        ------------Query 2 for check In Quantity ----
                                              (select itemcode,itemname,sum(qty) inqty from
                                            (select itemcode, itemname,qty from smd where doc_type ='OPN'
                                            union all
                                            select b.itemcode, b.itemname,sum(nvl(b.qty,0)) qty from smd b
                                            where (doc_type ='SAI' or doc_type = 'MRN')
                                            and (docdate <= :dd1)
                                            group by b.itemcode, b.itemname)
                                            group by itemcode,itemname                              
                                            ) qry2                                         
                                            ----------- to check the conditions ---------                                                                      
                                            on (qry1.itemcode = qry2.itemcode)
                                            and qry2.itemcode between :itm1 and :itm2          
    ORA - 00600

  • ABOUT query not affecting results or not using knowledge base

    Hello again,
    Another question here,
    I've searched through the forum and have found other
    posts on the same problem but no solutions, though
    the problem isn't always the primary topic of the
    forum. I've put this post up to hopefully put this
    to rest as I'm pretty sure this is just a
    configuration issue.
    I am using an ABOUT operator in a CONTAINS query and
    the query seems to return the same results as the
    same query without the about operator, eg:
    SELECT SCORE(0) AS scr,
    file_repository.file_id,
    file_repository.file_title
    FROM file_repository
    WHERE CONTAINS(index_url, 'ABOUT(australia)', 0) > 0
    versus
    SELECT SCORE(0) AS scr,
    file_repository.file_id,
    file_repository.file_title
    FROM file_repository
    WHERE CONTAINS(index_url, 'australia', 0) > 0
    I have included documents based on the default
    knowledge base should be found. For example I have
    three documents, one containing the term 'Tasmania'
    another containing 'Australia' and a third with
    'Pacific Area'. The first query above should return
    all three of these documents, but it only returns
    the one containing 'Australia'.
    I have used other examples from the default knowledge
    base and have had no success. I have not attempted to
    extend the knowledge base with a thesaurus as, from
    what I can tell, I shouldn't need to do this for it
    to work.
    Any help would be much appreciated.

    Hello.
    Did you load the supplied english thesaurus as your DEFAULT thesaurus using the command line utility ctxload (or some other method)?
    I had the same experience until I loaded the sample thesaurus in $ORACLE_HOME/ctx/sample/thes/. Now my ABOUT and SYN queries work as expected though I still have a concern about the incomplete nature of the sample thesauri (I'll open a new thread on that topic).
    Hope this helps.

  • XML SQL query not displaying result in SQLPLUS

    Have a registered schema and 1 xml document successfully inserted using Oracle 10.2.0.3.0
    I then run the following query:
    select extract(object_value,'/warehouse/warehousename')from xwarehouses;
    Expecting 1 record to be returned in SQLPLUS but get the following result:
    EXTRACT(OBJECT_VALUE,'/WAREHOUSE/WAREHOUSENAME')
    1 row selected.
    Can anyone shed any light? Is it a setting in SQLPlus

    Thanks A Non
    I still cannot see where I am going wrong!
    The schema registers okay. My inserts work fine.
    --register the schema
    begin
    dbms_xmlschema.registerSchema(
    'http://www.oracle.com/xwarehouses.xsd',
    '<schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oracle.com/xwarehouses.xsd"
    xmlns:who="http://www.oracle.com/xwarehouses.xsd"
    version="1.0"
    elementFormDefault="unqualified">
    <simpleType name="RentalType">
    <restriction base="string">
    <enumeration value="Rented"/>
    <enumeration value="Owned"/>
    </restriction>
    </simpleType>
    <simpleType name="ParkingType">
    <restriction base="string">
    <enumeration value="Street"/>
    <enumeration value="Lot"/>
    </restriction>
    </simpleType>
    <element name = "Warehouse">
    <complexType>
    <sequence>
    <element name = "WarehouseId" type = "positiveInteger"/>
    <element name = "WarehouseName" type = "string"/>
    <element name = "Building" type = "who:RentalType"/>
    <element name = "Area" type = "positiveInteger"/>
    <element name = "Docks" type = "positiveInteger"/>
    <element name = "DockType" type = "string"/>
    <element name = "WaterAccess" type = "boolean"/>
    <element name = "RailAccess" type = "boolean"/>
    <element name = "Parking" type = "who:ParkingType"/>
    <element name = "VClearance" type = "positiveInteger"/>
    </sequence>
    </complexType>
    </element>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end;
    --create the table
    CREATE TABLE xwarehouses OF XMLTYPE
    XMLSCHEMA "http://www.oracle.com/xwarehouses.xsd"
    ELEMENT "Warehouse";
    --Insert
    INSERT INTO xwarehouses VALUES(
    xmltype.createxml('<?xml version="1.0"?>
    <who:Warehouse xmlns:who="http://www.oracle.com/xwarehouses.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
    xs:schemaLocation="http://www.oracle.com/xwarehouses.xsd
    http://www.oracle.com/xwarehouses.xsd">
    <WarehouseId>1</WarehouseId>
    <WarehouseName>Southlake, Texas</WarehouseName>
    <Building>Owned</Building>
    <Area>25000</Area>
    <Docks>2</Docks>
    <DockType>Rear load</DockType>
    <WaterAccess>true</WaterAccess>
    <RailAccess>false</RailAccess>
    <Parking>Street</Parking>
    <VClearance>10</VClearance>
    </who:Warehouse>'));
    I don't know if you see the error
    Thanks again.

  • Content Query not producing results when using [Me] filter

    Hi
    I'm using a Content Query web part and I'm trying to show the most recent document modified by each site user by applying it across the site collection and using the Filter, Modified By [_Hidden] equals [Me]. However, this doesn't seem to work for any user
    - the web part is always blank. I have tried different combinations such changing equals to contains, and using the Modified By field etc - nothing gives me the correct results. If I instead take the [Me] out and instead use the "people chooser"
    and set to a specific person then I seem to get the results I would expect - however I cannot hard code a given user.
    Does anyone know how to use [Me] correctly?
    Thanks

    Hi  sjb500,
    According to your description, please take steps as below to meet your demand:
    With the page layout open in Design view, double-click the Content Query Web Part.
    In the Content Query Web Part dialog box, click the plus sign (+) next to Query to expand it.
    In the Source section, click Show items from all sites in this site collection.
    In List Type section, in the Show items from this list type, click Document Library.
    In the Content Type section, in the Show items of this content type group list, click Document
    Content Types.
    In the Content Type section, in the Show items of this content type list, click Document.
    In the Additional Filters section, under Show Items When, click Modified By [_Hidden] in
    the first box, click Is Equal To in the second box, and then click [Me].
    In the Content Query Web Part dialog box, click the plus sign (+) next to Presentation to expand it.
    In the Grouping and Sorting section, in the Sort items by list, click Modified
    and Select Show items in descending order.
    Click OK.
    Reference:http://office.microsoft.com/en-us/sharepoint-designer-help/display-data-from-multiple-lists-with-the-content-query-web-part-HA010174134.aspx
    [Me] is a variable that stands for the user who is currently viewing the page that contains the Content Query Web Part in the browser.
    Here is some scenarios using [Me] in Content Query Web Part:
    http://social.technet.microsoft.com/Forums/en-US/346ffbe6-d7ba-467e-b7f5-6d6e289677a1/user-tasks-web-part
    Please inform me freely if you have any questions.
    Thanks

  • Query not returning result..kindly help..?

    Query running forever..please help ?
    Help on the same is appreciated.
    Thanks

    I moved your original thread to SQL & PL/SQL. This one being locked to avoid confusion in between.
    Nicolas.

  • Mysql query with duplicate results

    I have a db that someone else set up that I am querying. It
    should have been set up to use a couple of different tables... one
    for clients and one for subclients with foreign keys to identify.
    However, each row has both the client and subclient which means
    there are duplicate clients since a single client may have several
    subclients.
    So...
    My query returns multiple clients where I need only one. I am
    guessing I can handle this in a loop with AS2.0 but I can't figure
    out how to tell when a unique client is detected. Does this make
    sense? Do I need to set my query up differently?

    try {
    ResultSet rs = DB.exQuery("SELECT max(transaction_date) as lastest_date, transaction_value,transaction_type"
                                  + "FROM transaction_log WHERE user_id =" + user.getId() + " AND is_credit = '1'");
    if ( rs.next () ) {can you explain
    *     trans_date = rs.getString("lastest_date");* // trans_date is a string type or date type... and max(transaction_date) as lastest_date returns which type...
         credit = rs.getString("transaction_value");
         trans_method = rs.getString("transaction_type");
    } catch(SQLException ex) {}

  • Switch from MySQL to MS SQL Server, Query not working

    I'm sure there is a simple setting somewhere for this, but cannot seem to find it and really would appreciate some assistance. Have an application which uses JDBC to connect to a MySQL DB to run the following query without an issue:
    SELECT * FROM users
    This returns the desired results. Changed to connect to MS SQL Server 2000 using the JDBC-ODBC bridge and the same query returns no results. The problem, SQL Server wants this query instead:
    SELECT * FROM [users]
    I don't want to have to change queries depending on the DB, as that is supposed to be one of the advantages of JDBC. Is there a setting in MySQL (or the JDBC driver) to have it work correctly if I pass table names in []? Or is there a setting in MS SQL Server (or in the JDBC, or ODBC) to have it accept queries without the []?
    Or is there a different approach that I'm missing which would avoid this whole problem?
    Thanks,
    Matt

    I suspect your database definitions are different. It has nothing to do with your java code.
    The bracket syntax is used to indicate the more standard quoted identifiers in standard SQL.
    Thus you could do this in oracle and in MS SQL Server...
    SELECT * FROM "users"
    I suspect that the above will work for your MS SQL Server database and will not work for your Oracle database. However if you created the table in oracle and specifically used "users" (with the double quotes around the name) when creating the table then it would work.
    Of course if the database definitions are different it means you must use different SQL for each. Just as if the name of the table was 'other' rather than 'users'.

Maybe you are looking for