rawsql Questions

3

I am migrating some data from other databases , so i am using raw sql queries for inserting data into database . But i don't know how to get last inserted id from raw sql queries in django. I have ...
Directive asked 12/2, 2013 at 12:1

8

Solved

I want to execute one update raw sql like below: update table set f1=? where f2=? and f3=? This SQL will be executed by ActiveRecord::Base.connection.execute, but I don't know how to pass the dy...
Crosswind asked 19/12, 2010 at 13:4

6

I have this cursor cursor.execute("SELECT price FROM Items WHERE itemID = ( SELECT item_id FROM Purchases WHERE purchaseID = %d AND customer_id = %d)", [self.purchaseID, self.customer]) I ...
Intellectualism asked 2/10, 2012 at 14:16

2

Solved

I am trying to write this raw SQL query, info_model = list(InfoModel.objects.raw('SELECT *, max(date), count(postid) AS freq, count(DISTINCT author) AS contributors FROM crudapp_infomodel ...
Fictive asked 18/6, 2016 at 20:31

1

Solved

I created this simple set of data to illustrate my point. It is a simple model with no further relations to any other model. I need to group the data above by topicid, find the max date for each...
Tea asked 19/6, 2016 at 14:3

1

The model of my project is database first, and uses remote access to database on another server. I need to use raw SQL query because my query is very complex and I feel more comfortable in SQl not ...
Saltern asked 29/5, 2013 at 6:53

2

Solved

I want to execute a raw sql using DBContext SqlQuery and then include related entites. I've tried the following but it doesn't load the related entities: string sql = "Select * from client where i...
Michael asked 28/9, 2011 at 9:52

1

Solved

Following this SO question, I'm trying to "truncate" all tables related to a certain django application using the following raw sql commands in python: cursor.execute("set foreign_key_checks = 0")...
Firn asked 28/1, 2011 at 23:18
1

© 2022 - 2024 — McMap. All rights reserved.