query-builder Questions
2
Solved
I am using active records to access the database. However, an additional feature requires me to use standard SQL query. Is it possible to use both active records and standard SQL query in the same ...
Least asked 4/6, 2011 at 23:0
3
Solved
I'm trying to get this query to work in CodeIgniter but it's spitting out an error:
A Database Error Occurred Error
Number: 1096
No tables used
SELECT *
If I put the query directly into...
Froh asked 29/1, 2011 at 19:47
4
Solved
It is possible to generate the following query using CI's query builder methods?
SELECT name
FROM table1 t1
JOIN
(SELECT ID FROM table2 ORDER BY id LIMIT 5) t2
ON t2.id=t1.t2_id
WHERE t1.id&...
Priestley asked 10/1, 2013 at 5:29
4
Solved
I've written a simple query for searching a keyword in the database.
$keyword = "keyword sample";
$keyword = str_replace(" ", "%", $keyword);
$this->db->selec...
Afrit asked 20/3, 2014 at 20:21
3
I'm using TypeORM(mySQL) for my Nestjs App. I want to change the column name on select using querybuilder. but it's not working.
const order = await this.connection
.createQueryBuilder(Orders,&quo...
Disjointed asked 7/7, 2022 at 16:35
7
Solved
How do I accomplish this in Laravel 4.1 Query Builder?
select * from orders where id = (select max(`id`) from orders)
I tried this, working but can't get the eloquent feature.
DB::select(DB::r...
Toomey asked 15/4, 2014 at 1:36
5
Solved
I'm trying to use the Doctrine QueryBuilder to perform the following SQL query:
DELETE php FROM product_hole_pattern php
INNER JOIN hole_pattern hp ON php.hole_pattern_id = hp.id
INNER JOIN hole_p...
Sophomore asked 25/6, 2013 at 15:39
3
Solved
I am confused about different TypeORM methods with similar purposes. From TypeORM docs:
.take() — pagination limit. Sets maximal number of entities to take.
.skip() — pagination offset. Sets numbe...
Meat asked 21/7, 2021 at 10:50
12
Solved
I'm trying to convert a query to an array with the method toArray() but it doesn't work for the query builder. Any ideas for convert it?
Example
DB::table('user')->where('name',=,'Jhon')->g...
Astred asked 25/12, 2013 at 20:50
7
Solved
I'm making a products search by filters:
My code:
->where(function($query) use($filter)
{
if(!empty($filter)){
foreach ($filter as $key => $value) {
$f = explode(",", $value);
$query-...
Lunna asked 31/3, 2014 at 10:6
6
Is there a way to get a table's primary key name using the Laravel query builder? Can i do something like
$key = DB::table($someTable)->getPrimaryKey();
I've looked through the documentation...
Aesop asked 16/4, 2018 at 16:5
12
Solved
I'd like to get value by the following SQL using Eloquent ORM.
- SQL
SELECT COUNT(*) FROM
(SELECT * FROM abc GROUP BY col1) AS a;
Then I considered the following.
- Code
$sql = Abc::from(...
Oleneolenka asked 18/7, 2014 at 11:25
3
Solved
I am using Query builder to insert data all fields are been inserted but timestamps like created_at and updated_at are not inserting they all have default 0:0:0 values
my insert query is
$id = DB...
Promisee asked 31/10, 2015 at 13:27
2
Solved
In my Dymfony2 / Doctrine2 application, I have a oneToMany relation between an object and its children.
I want to select all objects which have no children.
I'm stuck with various errors: SingleV...
Spongy asked 25/5, 2015 at 19:40
3
Solved
There is the following code
$form->with('Item')->add('parent', null, array(
'label' => 'Category',
'required' => true,
'query_builder' =>
function($er) use ($id) {
$qb = $er-...
Morisco asked 25/2, 2014 at 11:57
3
Solved
My application dynamically builds and runs complex queries to generate reports. In some instances I need to get multiple, somewhat arbitrary date ranges, with all other parameters the same.
So my...
Asylum asked 14/5, 2015 at 10:55
3
Solved
I'm new to Symfony, and I got an error while running a query :
public function getFilteredArticles($page, $nbPerPage, $data) {
$query = $this->createQueryBuilder('a')
->leftJoin('a.images'...
Jennie asked 6/6, 2017 at 14:11
4
Solved
In my Symfony2 repository, I'd like to get objects from a schedule table, that have started, but not finished yet. The interval, within the objects should be encountered as 'not finished', should b...
Midway asked 13/8, 2012 at 14:45
14
Solved
I have the following code which gives me the error:
Message: Invalid parameter number: number of bound variables does not match number of tokens
Code:
public function getCount($ids, $outcome)
...
Waltraudwaltz asked 8/5, 2011 at 17:26
9
Solved
I am looking for group by queries through Sequelize and cannot seem to find any documentation.
SELECT column, count(column)
FROM table
GROUP BY column
Mullein asked 25/3, 2014 at 6:48
8
Solved
I am new to laravel query builder, I want to search multiple words entered in an input field for example if I type "jhon doe" I want to get any column that contains jhon or doe
I have seen/tried s...
Couperin asked 2/2, 2015 at 2:12
4
Solved
I'm new to laravel and I have some issues with the query builder.
The query I would like to build is this one:
SELECT SUM(transactions.amount)
FROM transactions
JOIN categories
ON transactions.cate...
Dick asked 24/5, 2015 at 15:4
7
I would like to use the query builder with the LIKE operator but it's not working properly.
Here is my code in my controller :
public function listall($query) {
$Clubs = Club::where('clubs.name...
Oldfashioned asked 17/3, 2017 at 20:7
3
Solved
Simple Question: I have a (MySQL) table with two date columns (from, until) and ask it with
select * from mytable where until > from + interval 4 week;
This is really simple in MySQL.
How co...
Phares asked 3/11, 2015 at 12:47
5
Solved
Im trying to pull all users from the users table who match a certain group in the users_groups pivot table. Im using Sentry 2 from Cartalyst btw.
This works to get all users with first and last n...
Overweigh asked 10/10, 2014 at 18:54
1 Next >
© 2022 - 2024 — McMap. All rights reserved.