I am currently self-learning SQL so for most of you this would probably seem like a simple question (if I expressed it correctly). I have a table ‘orders’ that look like this: What I want to do is count the times that any item from 2 lists of items (as in IN (itmsid1, itmsid2) coexists for all Ordmids. For example,
Tag: firebird
Mysql Procedure Syntax change to Firebird Procedure Syntax
I don’t know what’s different about the stored procedure of firebird syntax. MySql Procedure: How can I change this one syntax for Firebird stored procedure? Answer The equivalent in Firebird PSQL syntax would be simple assignment, so GEN_EXCEPTION_FROM = PSHIFTDTEFROM; See also Assignment Statements in the Firebird Language Reference. The full equivalent of the fragment shown in your question would
SQL similar to regex, equivalents for start ^ and end $ of line
I want to use a regex like (^|s)1001(s|$) in a Firebird similar to expression: Examples: abc 1001 abc – true abc 121001 abc – false 1001 abc – true 121001 – false abc 1001 – true I try’d to convert it to a regex in Firebird: Where COLUMN similar to (^|[:WHITESPACE:])abc 1001 abc($|[:WHITESPACE:]), but ^ (start of line) and $
Fetch most recent value – sql execution time too long
I have a Firebird database with a table with two columns: Date and value. I want to get the most recent value. Problem is, that this table can have easily over 200k rows. My select query takes more than 400ms, which is just to long for my application. Is there any way, I can speed this up? I can’t change
Combining 2 queries in 1 (select based on other select)
I have 2 queries: and second one base on first one They work nice, but I need them to work as a one combined query, result from access looks like this: But this gives me only empty table. Can you help me? Answer Your inner join depends on the right-hand-side table of the left join, this effectively converts that left
Building complex SQL command
I am using sql for select, update, insert and some other features, but only simple ones until now. Now I need to write a complex command. I have looked at using case but I do not know how to implement it. This is what it should look like: I used ~TACNO~ to point out where I need a conditional value.
Copying tables from one database to another, in Firebird 2.1
I need to copy tables from one database to another in Firebird 2.1, but in some way which is pretty quick and you can run this on console. I used FBcopy but get the answer from boss that it is too slow. This must be done in more than one transaction because tables are quite big. Any ideas how I
Select everything except rows with maxvalue in certain column
I have a table with data and I’m trying to select some values with lower value than maximum. I am using IBExpert, I need to do this in SQL because I am working on a Firebird database. My table looks like this: What I want is to select only rows with GRUPA values lower than maximum, here max value is
How to check if a column is being updated
Let’s suppose I have an instruction that does the following: Is there any way to do it in Firebird, the same thing as Oracle does … The trigger would only be executed if it had only only updating the “active” column. I tried that way, but it’s not working: Answer Firebird doesn’t have anything like updating. You need to compare
Firebird with .net driver – drop table if exists
I’m new to Firebird and I’m testing a few things to check out the differences between Fb and SQlite (and the .net driver). I am trying to do a drop table if exists followed by the creation of a table. In Sqlite I am able to do this by: However in Firebird the same query fails. I’ve read that this