Questions tagged [rawsql]
95 questions
0
votes
1 answer
Running Plain SQL dynamically in Quill using infix fails with wrong query syntax during runtime
I want to construct my query in plain SQL and then run it using Quill, I am using infix operator .
My code is like this.
case class Employee(name: String, age: String, company_name: String)
case class Company(name: String, pin_code: String)
case…

user9920500
- 606
- 7
- 21
0
votes
1 answer
How to get rows from table doc_val with minimum "val" from table doc_val for each of the doc_id where criteria = 'L'
You have two tables:
1. docs
2. doc_val
Point of focus is table : doc_val , it has doc_id FK from table docs , field critera which will
be our condition.
Mysql schema:
CREATE TABLE IF NOT EXISTS `docs` (
`id` int(6) unsigned NOT NULL,
`rev` int(3)…

Utsav Shrestha
- 107
- 1
- 1
- 6
0
votes
1 answer
Cannot select specific column in SqlQuery - Entity Framework code-first
I have a problem when I am using SqlQuery method to try to get some data from database, everything is perfect if I get to all column like this:
data.Items.SqlQuery("SELECT * FROM dbo.Items WHERE iID = '1' ORDER BY iTitle")
But I just want to get…

thebugisreal
- 11
- 3
0
votes
1 answer
Execute select query in Apache metamodel
I am using Apache meta model with postgres database. I want to execute a simple SQL select query. Can some one please help me how to achieve this functionality ??

Subhradip Bose
- 3,065
- 2
- 13
- 17
0
votes
1 answer
How to use Is null or empty in raw sql for assigned value which is not in table?
How to check IsNullOrEmpty in RawSQL .If control number and sender Id both have values,then check like condition for both.If it having sender id alone check like condition for sender id alone and If it having controlnumber alone check like condition…

Achu_L
- 175
- 1
- 13
0
votes
3 answers
To update the field in database using Raw SQL?
I need to update IsIgnored field based on senderId when I check in where condition,It not identifying senderId which I compared from loop.It throws exception like ambiguous column name 'senderid'.Guide me on this to resolve this issue.
foreach…

Achu_L
- 175
- 1
- 13
0
votes
1 answer
Slaves not used in Symfony 4 with Raw Queries
I'm using Symfony 4 to interface with an existing Master/Slave MySQL setup and am executing queries against the server using raw sql. Raw SQL is the only option at the moment.
I'm using show full processlist; on the DB server to monitor which DB is…

Dbl0McJim
- 196
- 1
- 13
0
votes
2 answers
Why Raw sql doesnt work in laravel DB
I have this sentence:
$lastOperationUser = DB::select("SELECT last_operation FROM policies
INNER JOIN(users)
ON (policies.user_id=users.id)
group by (user_id);");
If I execute…
user3892232
0
votes
0 answers
Use response of a method to define a model field in Django
I need some dynamic choices fields in a django model and I want to validate if a table exists before get them.
I already know how to check if the table exists with raw sql and also I know how to generate my dynamic tuple for choices, but I don't…

Miknotauro
- 31
- 4
0
votes
2 answers
'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
I did raw SQL query below to select only certain fields from a table.
{
List CustomerVMlist = new List();
var cid = db.Customers.SqlQuery("select SchedDate from Customer where CustID = '@id'").ToList();
}
But i…
user8669202
0
votes
1 answer
executing raw sql in django error: relation does not exist
I am attempting to execute a raw sql query and I am getting the following error:
relation "venue" does not exist
the query is as follows:
cityList = Venue.objects.raw("SELECT DISTINCT city FROM Venue")
the model I am grabbing from looks like…
user6781560
0
votes
1 answer
Raw Sql - System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
I did raw SQL query below to select only certain fields from a table.
var qry = "SELECT ptitle, pname, paid, pidno, pdob, pgender, ptelh FROM patient where ";
if (strPatientName != "")
{
qry += "name like…

Nurul
- 147
- 1
- 3
- 15
0
votes
2 answers
Database.ExecuteSqlCommandAsync autocommit transaction?
I have a doubt, the _context.Database.ExecuteSqlCommandAsync method autocommit a transaction or not.
My code looks like this:
using (DatabaseContext _db = new DatabaseContext())
{
using(var _transaction = _db.Database.BeginTransaction())
…
0
votes
1 answer
Is a custom class required for raw SQL queries in the Entity Framework?
I am confused on something. I understand what an ORM is doing, and I understand what EF is. What I'm hazy on is the part where I do not want to use the specialized constructs to get the data. I want to use SQL. If I create a complex query in…

johnny
- 19,272
- 52
- 157
- 259
0
votes
1 answer
Django: Raw SQL with connection.cursor()
I am a complete newbie to Django. I need to perform the following query and use img.img_loc to populate a list of images in a template:
SELECT img.img_loc, author.surname, author.given_name, author.email
FROM image_full AS img
LEFT JOIN…

doubleOK
- 353
- 6
- 19