I have the following table schema:
db.version(1).stores({
sales: "[item_id+date],sales"
});
Where the combination of date and item_id must be unique. How can I get all the records for a given item_id using the where clause (disregarding the date)?
The following produces an error:
db.sales.where('item_id').equals(some_item_id)
Unhandled rejection: SchemaError: KeyPath item_id on object store sales
is not indexed
db.sales.where('[item_id+date]').between ([some_item_id, -Infinity], [some_item_id, Dexie.maxKey])
Related
I'm trying to create a calculated column that sums a column if another column equals something.
I am using this formula, which I think should work, but it's giving the error Argument must be a range..
=SUMIF(type, "a", age)
My sample data:
My pivot table with the error:
I have a problem with data type and relationship between two tables
let's assume I have two tables as shown in the image
First table: Attached _file. The ID coulmn is number
Second table: FN_Transaction. the ID coulmn is varchar(20)
The ID in FN_Transaction has four cases
ID is null which means there is no attached file
ID has text as 'No' cell which means there is no attached file
ID starts with 0, but it will be equaled ID in Attached _file table such as 01222 = 1222
ID in FN_Transaction equals ID in Attached _file without 0 such as 2344 = 2344
let's see the query
with docs as
(
SELECT
ID,
COUNT(type) fileNo,
MAX(Date) date
FROM
Attached_file
GROUP BY
ID
)
Select
InvoiceNo,
fileNo,
date,
Amount
from
FN_transaction x1
left join docs x2 on
(Trim(x1.ID) = x2.ID)
the error that I got
Error report -
SQL Error: ORA-12801: error signaled in parallel query server P034, (1)
ORA-01722: invalid number
12801. 00000 - "error signaled in parallel query server %s"
*Cause: A parallel query server reached an exception condition.
*Action: Check the following error message for the cause, and consult
your error manual for the appropriate action.
Do you have an idea about how to handle this type of column?
Please advise
You can use the default on conversion error clause in TO_NUMBER function (introduced in 12.2) as follows:
ON ( to_number(X1.ID default null on conversion error) = X2.ID )
Note that 01222 will be automatically converted to a number 1222. character NO will be converted to NULL because of default on conversion error and it will not match the join condition(which satisfies your requirement)
I have a table named visits in where I save visited pages. It contains a column named user_id , if the user is authenticated I save his id else I set it null.
I'd like to replace all user_id null by a word "visitor" inside the query.
Based in this sql example How to replace null with string when column is of datatype int I have make this query:
// ..............
$builder->select('visits.*', DB::raw("ISNULL(str(user_id), Visitor) as name"));
But I get this error:
Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1582 Incorrect parameter count in the call to native function 'ISNULL' (SQL: select count() as aggregate from (select visits., ISNULL(str(user_id), Visitor) as name from visits
Am trying execute a sql query on oracle database and inserting the result into another table, for my trial am just performing a simple query as
SELECT 1 AS count
FROM dual
and trying to insert that into a single column table which has the name COUNT.
The content of the record on Nifi seems to be as follows
[
{
"COUNT" : "1"
}
]
but the logs keeps throwing the error
due to java.sql.SQLDataException:
None of the fields in the record map to the columns defined by
the schema_name.table_name table:
any ideas ?
I believe you get that same error message if your table name doesn't match. The Translate Field Names property only translates the fields (columns), not the table name. Try specifying the schema/table in uppercase to match what Oracle is expecting.
I am using the following code to query a row from two joined tables:
s.database.GetDatabase().Model(&dbUser).Related(&result, "Registrations")
However when i use select as follows:
s.database.GetDatabase().Model(&dbUser).Select("name").Related(&result, "Registrations")
it show the following error and returns zero records
(pq: zero-length delimited identifier at or near """")