Skip to content

Tag: sql

Can you somehow overload the query in a method?

So there’s a Customer and a Seller and they’re both User. The only difference between them is that seller has a NameOfBusiness and customer does not. In the DAL I have this code: Is there a way to overload the query OR change the query so that you can fill in a NULL for NameOfBusiness? Answer Opti…

Select a specific time in DB2 from the currenttime

I am trying to do a select and set the time to 10AM in DB2. Ive tried however this sets the time to 0:00:00, im trying to get it set to 10AM, is there a way to do this in DB2? Answer Please can you try this: Here is the DEMO Also, in your question example you have one open

How to merge rows into one row with separator

I need merge rows into one row for summary of calculation (SQL Server 2014). My SQL query is: Result of this query is: I would like to have this result: When add new currency (x), the result of new currency must be appended: Can somebody please help me with this topic? Many thanks Answer Something like this s…

CASE expression in WHERE clause for diferent and

Can I use case expression to build where like this? I need change where clause depending on the value of x variable. Answer An alternative to using OR is to use nested CASE statements: or you could simplify it to: However, you should check whether Oracle can use column indexes or if a separate function-based …

Transform table to smoothen records in one column

the situation (a real life situation) is: I have a table with “log” records, for simplicity let’s assume there are only columns NAME, TIME, STATE (in reality there are few more). There are cca 1 Milion rows in which there are 100 Names (computers) and cca 10 states (productive, idle, automat…