This question already has an answer here: Access variables from parent scope in anonymous PHP function 1 answer There is an example in the Cookbook: $query = $cities->find() ->where(function ($exp, $q) { return $exp->notIn('country_id', ['AFG', '
I have a column in a table where values are like this: 105,65 106,8 107 108,1234 Now I have to output it in 16,4 format removing the comma. I tried REPLACE(RPAD(LPAD(AMOUNT, 16, '0'), 20, '0'), ',', '') But it is always right padding 4 zeros to the r
Take these two queries:- SELECT * from movies WHERE (year BETWEEN 1990 AND 2000) AND (genre='comedy'); SELECT * from movies WHERE year BETWEEN 1990 AND 2000 AND genre='comedy'; Are they always same technically, giving same output? Or does it depend o
Please consider the following SQL Schema and statement. http://sqlfiddle.com/#!3/06c46/1/0 Table: CREATE TABLE EcomGroupProductRelation ( GroupProductRelationGroupID varchar(10), GroupProductRelationProductID varchar(10), GroupProductRelationSorting
I'm looking for an efficient way to convert rows to columns using T-SQL. This the sample data: +----+--------------+----------------+ | ID | ColumnName | Value | +----+--------------+----------------+ | 1 | FirstName | Name 1 | | 2 | FirstName | Name
If the student have two studentsubjectstatus as Merit studentperformance is Merit. If the student have two studentsubjectstatus as Pass studentperformance is Pass Else is a Fail So i need a new column studentperformance and the output will be like th
I've to Update a table which has two columns and 300 rows In which One column is filled already and the second column is Null. How to Update the Null column at once using a query. What I've tried is UPDATE tablename SET Column_2 = ( CASE column_2 WHE
I'm working on an application in which I retrieve data from a database to be displayed in a table in my cshtml. One of the fields I'm calling is a date field. The data for it in the database is stored in the following format: MMDDYY i.e; 091504. For
The basic syntax for an After Update trigger in TSQL is: CREATE TRIGGER [dbo].[triggerName] ON [dbo].[Table] AFTER UPDATE, INSERT --trigger when Update or Insert in table AS BEGIN SET NOCOUNT ON; IF UPDATE (ColumnA) -- if ColumnA updates start begin
So, I'm aware this isn't exactly a programming question but I felt it was still appropriate. What is the difference between Oracles proprietary RDBMS, that they license, vs MySQL, an open source DBMS they bought? Performance? Support? Security? Featu
I have three tables towns , patientsHome,patientsRecords towns Id 1 2 3 patientsHome Id | serial_number 1 | 11 2 | 12 2 | 13 patientsRecords status | serial_number stable | 11 expire | 12 expire | 13 I want to count stable and expire patients from pa
I have two tables, TabelA and TabelB. Both have an ID column that is the primary key. In addition, TabelB has an A_ID column. The other columns are not relevant here. create table TableA ( ID serial primary key, ..., ) create table TableB ( ID serial
I would like to force limit the number of records being queried from the SQL Server in a way that I can report back the to user that they need to optimize their query. Intending to use it a reporting tool where let's say the user is not supposed to e
This is the SQL statement: SELECT opc.contenido, COUNT(r.idOpcPregunta) from Opcionesrespuestas as opc LEFT JOIN Respuestasimples as r ON r.idOpcPregunta = opc.idOpcPregunta where opc.idPregunta ='6' GROUP BY opc.idOpcPregunta; This is a HQL select o
I have database mysql with table 'tblevel' with column 'waktu' with varchar data type. and the column hold values like this: 30-01-2014 12:19:09 The value will be converted to timestamp, because I have to do that for data viewing in graphic, in this
Friends, in my project I have a variable named bill_number; every time the PRINT bill button is clicked I want to increase the value of bill_number by one in the database. Please help me as soon as possible. set @bill_number = @bill_numer+1; This is
I have two tables in the same MS Access database, one called Consultant Doctor and the other is Patients. The primary key in Consultant Doctor is DoctorID, which is linked to the DoctorID in Patients. The user inputs the patients ID and it should sho
How can I perform a Query to my Database (using tOracleInput), like a Select, and use Strings that are already defined as parameters in other components, for example in a 'tFlowToIterate' ? For example: "SELECT * from TABLE_X where FIELD_X= ? ;"
I'm working with postgresql with postgis. I have few questions: trying to insert into a table with polygon column using the following syntax: ST_GeomFromText('POLYGON((long1 lat1, long2 lat2, long3 lat3))') fails with the following error: function ge
Hello I have got this following statement that I would like it to INSERT INTO if there wasn't found any value with id = 1 If it exist I would like to update I inspired by this: UPDATE Table1 SET (...) WHERE Column1='SomeValue' IF @@ROWCOUNT=0 INSERT
Here's an example for what I am looking to do : I have 3 tables : Villages (id, name) Households (id, village_id) Persons (first_name, last_name, household_id) I would like to make sure there isn't 2 persons who have the same first name and last name
Can I override a value in a column such that if a case is true, it tells value x to be equal to another dynamic value in the query. Here's pseudocode. I know this doesn't work. Select jobTitle, managerTitle, bigBossTitle, CASE WHEN jobtitle like '%DE
I want to create a drop down option using Magento module that populate the data from the database I created. Previously, I have this code in My IndexController.php which is work. This is the first code. public function dropdownAction() { if (file_exi
I'm building a small internal phone number extension list. In the database I have two tables, a people table, and a numbers table. The relationship is a one-to-many respectively. I want to display the results in a single HTML table with one person pe
I'd like to implement a dynamic property on a Core Data model but am unclear as to whether this is supported, and if so... how? The idea is to have a model with a set number of non-dynamic fields, such as created_at, updated_at, start_at, end_at, etc
I'm currently working with a database table that is structured as follows: ______________________________ | id | content | next_id | |------|-----------|-----------| | 1 | (value) | 4 | | 2 | (value) | 1 | | 3 | (value) | (NULL) | | 4 | (value) | 3 |
Is there simpler way to convert CSV files to SQL file than this?: BufferedReader input = new BufferedReader(new FileReader(new File("c:\\file.csv"))); Writer output = new BufferedWriter(new FileWriter(new File("c:\\file.sql"))); try {
Update: After playing around with this for a few hours, went with a multi-query solution and used a table that only contained parent attributes to determine which items needed updating. Sorry for the poor title, I couldn't think how to concisely desc
I have a table with dated records. I want a query that will show the number of records for each date. Not hard, just a GROUP BY, right? Sure. But I want to also show days where there were NO records. In this case, I would need to left join against a
This is an SQL problem I can't wrap my head around in a simple query Is it possible? The data set is (letters added for ease of understanding): Start End 10:01 10:12 (A) 10:03 10:06 (B) 10:05 10:25 (C) 10:14 10:42 (D) 10:32 10:36 (E) The desired outp