Skip to content
Advertisement

Can we fire a database query in config/constants.php file to make constants dynamic? (Php Codeignitor)

I have tried to place this at the bottom of the config/config.php but it is throwing this error: An uncaught Exception was encountered Type: Error Message: Class ‘CI_Controller’ not found Filename: E:xampp74htdocsjrvssystemcoreCodeIgniter.php Line Number: 369 Please suggest me some solution for this. If this is not possible then what else we can do to make constants dynamic? Answer constants.php is

How can I partition by group that falls within a time range?

I have the following table showing when customers bought a certain product. The data I have is CustomerID, Amount, Dat. I am trying to create the column ProductsIn30Days, which represents how many products a customer bought in the range Dat-30 days inclusive the current day. For example, ProductsIn30Days for CustomerID 1 on Dat 25.3.2020 is 7, since the customer bought

REGEX in stored procedure in “=”/like clause

I’ve created a stored procedure with 3 inner joins (please, don’t judge me :D): TableAnotherTable is the association table between Table and AnotherTable. So, this stored procedure works in some cases (if ET.Value is equal to A.Value). But if: the stored procedure must also work. How can I change the last ON of the inner join clause (with “=”) to

Searching through different tables?

I have several tables with a Sequence as the primary key. They are unrelated at all, there are no foreign keys or anything, or anything that could link one to another, so join won’t work. Union won’t work either because they are basically different tables. I know that you could assign “null” to those columns that exist in one table

Combining data into one table cell

There is a query that returns a temporary table. TSQL Query: Result: Random sampling of output values Is it possible to group data from the last column, thereby reducing the number of lines in the output. That is, I need it to be like this: Desired result UPD: SQL Server 2016. STRING_AGG is missing Answer Group by the values you

How to convert an array of key values to columns in BigQuery / GoogleSQL?

I have an array in BigQuery that looks like the following: SELECT params FROM mySource; Which looks like this: params [{ key: “name”, value: “apple” },{ key: “color”, value: “red” },{ key: “delicious”, value: “yes” }] How do I change my query so that the table looks like this: name color delicious apple red yes Currently I’m able to accomplish

Does declaring variables inside an exec improve SQL query plans?

I have a bunch of stored procedures that I’m looking to optimize and want to know if changing from having the variables injected into the WHERE condition to having them inject into a variable declaration will help The current statements look like this where the ids are passed into the stored procedure and then injected into the EXEC Would there

Power function in T SQL

The following returns .81 as expected: But this does not. Its return value is .8: To have it return .81, I have to cast the input: Why is a cast needed here? What am I missing? Answer The power function return type is dictated by the data type of the first parameter. Here, you’re giving it a decimal(1,1). As noted

Update multiple columns/rows case statement SQL

I have looked at similar questions previously but they seem to update a single column with multiple case conditions and the one answer I found for multiple columns seems a little long. Let’s say I have a table like this: Column_1 Column_2 Column_3 Column_4 Column_5 First Value 1 Second Value 2 …. …. Twelfth Value 3 I want to use

Advertisement