Search Results

Search found 4815 results on 193 pages for 'parameterized queries'.

Page 14/193 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Combining multiple queries in one in Access

    - by Arlen Beiler
    I have two queries that I want to combine into one in Microsoft Access 2003. SELECT AttendanceQuery.AttendDate, Count(*) AS Absent FROM AttendanceQuery WHERE (((AttendanceQuery.Present)=False)) GROUP BY AttendanceQuery.AttendDate; SELECT AttendanceQuery.AttendDate, Count(*) AS Enrollment FROM AttendanceQuery GROUP BY AttendanceQuery.AttendDate; The one shows the total records for each date, the other shows the ones that are marked absent.

    Read the article

  • How to kill locked mysql queries

    - by jcure
    Hi, I am creating and testing a mysql join query but each time so far it causes the database tables to lockup and the site hangs. I have to then call the host and they kill the locked queries. Is this something I can do from phpmyadmin so not to bother them while I tweak the script to work? Thanks for any reply.

    Read the article

  • ADOdv sanitizing queries

    - by pixel
    Just trying to make sure all my queries are sanitized. We're using ADOdb (it's already in place, so no talking me out of it). Is there something in ADOdb like mysql_real_escape_string?

    Read the article

  • Stored Queries?

    - by phpeffedup
    Is it considered crazy to store common SQL queries for my web app in a database for use in execution? Or is that common practice? Or is it impossible? My thinking is, this way, I avoid hard-coding SQL into my application files, and add another level of abstraction. Is this crazy? Is this what a stored procedure is? Or is that something else?

    Read the article

  • MySQL Non Index Queries Analysis

    - by Markii
    I'm using the log queries not using index but it logs all that use indexes but just more advanced or using IFs. Is there a parser or a program out there that can analyze the log and give me a literal output of saying "table.column should be a index" Thanks

    Read the article

  • Dynamically assembling SQL queries in Java

    - by kd
    What is the best way to assemble an SQL query with join conditions dynamically? I don't want to hard code the query for each different condition on a webpage or a set of webpages. Is it even feasible? I got as far as being able to assemble simple queries but i got stumped when i needed to insert join conditions, i.e. how to figure out dependencies for joins etc.

    Read the article

  • MySQL Queries using Doctrine & CodeIgniter

    - by 01010011
    Hi, How do I write plane SQL queries using Doctrine connection object and display the results? For example, how do I perform: SELECT * FROM table_name WHERE column_name LIKE '%anything_similar_to_this%'; using Doctrine something like this (this example does not work) $search_key = 'search_for_this'; $conn = Doctrine_Manager::connection(); $conn->execute('SELECT * FROM table_name WHERE column_name LIKE ?)', $search_key); echo $conn;

    Read the article

  • difference between where and nested queries

    - by Chris H
    I'm not able to figure out the difference between these queries. I'm pretty sure that the first one is an equi-join. I'm not sure how the second one ISN'T the same as the first. The sub query in #2 selects all Ids from S, and then it returns all R's that also have those ID's, no? SELECT R.cname FROM R, S, WHERE R.Id = S.Id SELECT R.cname FROM R WHERE R.Id IN (SELECT S.Id FROM S)

    Read the article

  • [ZF] How to use Zend_Db without SQL Queries?

    - by rasouza
    The last time I worked with Zend_Db I recall I used to write SQL Queries manually. I've been searching for some ORM application, but, since I read something like Zend_Db is also capable of doing so, I started to try it, but I can't find neither a good tutorial explain it or a good documentation. I read something lake Gateway pattern and ModelMapper class but I can't figure it out. Can someone shine my path? :P

    Read the article

  • Which of these queries is more efficient?

    - by Brian
    Which of these queries are more efficient? select 1 as newAndClosed from sysibm.sysdummy1 where exists ( select 1 from items where new = 1 ) and not exists ( select 1 from status where open = 1 ) select 1 as newAndClosed from items where new = 1 and not exists ( select 1 from status where open = 1 )

    Read the article

  • Django Admin Running Same Query Thousands of Times for Model

    - by Tom
    Running into an odd . . . loop when trying to view a model in the Django admin. I have three related models (code trimmed for brevity, hopefully I didn't trim something I shouldn't have): class Association(models.Model): somecompany_entity_id = models.CharField(max_length=10, db_index=True) name = models.CharField(max_length=200) def __unicode__(self): return self.name class ResidentialUnit(models.Model): building = models.CharField(max_length=10) app_number = models.CharField(max_length=10) unit_number = models.CharField(max_length=10) unit_description = models.CharField(max_length=100, blank=True) association = models.ForeignKey(Association) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) def __unicode__(self): return '%s: %s, Unit %s' % (self.association, self.building, self.unit_number) class Resident(models.Model): unit = models.ForeignKey(ResidentialUnit) type = models.CharField(max_length=20, blank=True, default='') lookup_key = models.CharField(max_length=200) jenark_id = models.CharField(max_length=20, blank=True) user = models.ForeignKey(User) is_association_admin = models.BooleanField(default=False, db_index=True) show_in_contact_list = models.BooleanField(default=False, db_index=True) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) _phones = {} home_phone = None work_phone = None cell_phone = None app_number = None account_cache_key = None def __unicode__(self): return '%s' % self.user.get_full_name() It's the last model that's causing the problem. Trying to look at a Resident in the admin takes 10-20 seconds. If I take 'self.association' out of the __unicode__ method for ResidentialUnit, a resident page renders pretty quickly. Looking at it in the debug toolbar, without the association name in ResidentialUnit (which is a foreign key on Resident), the page runs 14 queries. With the association name put back in, it runs a far more impressive 4,872 queries. The strangest part is the extra queries all seem to be looking up the association name. They all come from the same line, the __unicode__ method for ResidentialUnit. Each one is the exact same thing, e.g., SELECT `residents_association`.`id`, `residents_association`.`jenark_entity_id`, `residents_association`.`name` FROM `residents_association` WHERE `residents_association`.`id` = 1096 ORDER BY `residents_association`.`name` ASC I assume I've managed to create a circular reference, but if it were truly circular, it would just die, not run 4000x and then return. Having trouble finding a good Google or StackOverflow result for this.

    Read the article

  • How to write php->mysql queries?

    - by Bluemagica
    Is there any good tutorial that has all the basic rules for writing queries to store $_Post vars from php to mysql? Like when to use backticks and singleqoutes, and how to safely write code with functions like get_magic_quotes_gpc()? Another thing is, assuming there is no javascript validation(since the user can easily turn it off), how should I handle empty form fields being sent as empty $_post variables and throwing errors? Do I have to use isset() call on all the post variables? What is the best way to handle users turning off javascript validation on a form?

    Read the article

  • Help combining these two queries

    - by Horace Loeb
    I need a SQL query that returns results matched by EITHER of the following SQL queries: Query 1: SELECT "annotations".* FROM "annotations" INNER JOIN "votes" ON "votes".voteable_id = "annotations".id AND "votes".voteable_type = 'Annotation' WHERE (votes.vote = 't' AND votes.voter_id = 78) Query 2: SELECT "annotations".* FROM "annotations" INNER JOIN "songs" ON "songs".id = "annotations".song_id INNER JOIN "songs" songs_annotations ON "songs_annotations".id = "annotations".song_id INNER JOIN "users" ON "users".id = "songs_annotations".state_last_updated_by_id WHERE (annotations.referent IS NOT NULL AND annotations.updated_at < '2010-04-05 01:51:24' AND (body = '?' OR body LIKE '%[?]%') AND ((users.id = songs.state_last_updated_by_id and users.needs_edit = 'f' and songs.state != 'work_in_progress') OR (songs.state = 'published')) Here's what I tried, but it doesn't work: SELECT "annotations".* FROM "annotations" INNER JOIN "songs" ON "songs".id = "annotations".song_id INNER JOIN "songs" songs_annotations ON "songs_annotations".id = "annotations".song_id INNER JOIN "users" ON "users".id = "songs_annotations".state_last_updated_by_id INNER JOIN "votes" ON "votes".voteable_id = "annotations".id AND "votes".voteable_type = 'Annotation' WHERE ((votes.vote = 't' and votes.voter_id = 78) OR (annotations.referent IS NOT NULL and annotations.updated_at < '2010-04-05 01:43:52' and (annotations.body = '?' OR annotations.body LIKE '%[?]%') and ((users.id = songs.state_last_updated_by_id and users.needs_edit = 'f') OR songs.state = 'published')))

    Read the article

  • Simpler Linq to XML queries with the DLR

    - by Xavier
    Hi folks, I have a question regarding Linq to XML queries and how we could possibly make them more readable using the new dynamic keyword. At the moment I am writing things like: var result = from p in xdoc.Elements("product") where p.Attribute("type").Value == "Services" select new { ... } What I would like to write is something like: var result = from p in xdoc.Products where p.Type == "Services" select new { ... } I know I can do this with Linq to XSD which is pretty good already, but obviously this requires an XSD schema and I don't always have one. I am sure there should be a way to achieve this using the new dynamic features of .NET 4.0 but I'm not sure how or if anyone already had a go at this. Obviously I would loose some of the advantages of Linq to XSD (typed members and compile time checks) but it wouldn't be worse than the original solution and would certainly be more readable. Anyone has an idea? Thanks

    Read the article

  • Create Django formset wihtout multiple queries

    - by Martin
    I need to display multiple forms (up to 10) of a model on a page. This is the code I use for to accomplish this. TheFormSet = formset_factory(SomeForm, extra=10) ... formset = TheFormSet(prefix='party') return render_to_response('template.html', { 'formset' : formset, }) The problem is, that it seems to me that Django queries the database for each of the forms in the formset, even though the data displayed in them is the same. Is this the way Formsets work or am I doing something wrong? Is there a way around it inside django or would I have to use JavaScript for a workaround?

    Read the article

  • Using sub filters/queries in Google App Engine

    - by fredrik
    Hi, I'm trying to use figure out how to sub query a query that uses a filter. From what I've figured out so far while using .filter() it changes the original query, that leads to a second .filter() would also have to match the first filter. I would like to make something like this: modules = data.Modules.all().filter('page = ', page.key()) modules.filter('name = ', 'Test') modules.filter('name = ', 'Test2') I can't get the "Test2" filter to work. The only solution I have at the moment is to make all new queries. data.Modules.all().filter('page = ', page.key()).filter('name = ', "Test").get() data.Modules.all().filter('page = ', page.key()).filter('name = ', "Test2").get() Or write the same as an GQL. But for me it seams quite stupid way to go. I've looked at using ancestors, but I don't quite understand it and honestly don't know if that's the way to go. Any ideas? ..fredrik

    Read the article

  • How can I run NHibenate queries asynchronously?

    - by andrey-tsykunov
    Hello, One way to increase scalability of the server application is to run IO-bound operation (reading files, sockets, web requests, database requests etc) asynchronously. This does not mean run then in the ThreadPool which will just block threads while operation is being executed. The correct way is to use asynchronous API (BeginRead, BeginGetResponse, BeginExecuteReader etc). The problem is well described in CLR vi C# book. Here is some article about asynchronous queries in Linq to SQL. Are any ways to execute Nhibernate query asynchonously? What about Linq to NHibernate? Thank you, Andrey

    Read the article

  • Need to debug LINQ simple queries in Visual Studio 2010

    - by maxima120
    I often get in a position when I need to know why my LINQ doesnt work as intended... I use object collections and extensions. I dont want spend more than couple of minutes on it. LINQ supposed to make developer's life easier not harder. I hoped VS 2010 will have it fixed but I now use RC and it still doesnt let me type LINQ and check what is going on... Says as before "Expression cannot contain lambda expressions"... Is there some add-on for Visual Studio so I can quickly and effectively run ad-hoc queries and find out what is going on and where I am wrong?

    Read the article

  • Making complex queries through SQLiteDatabase

    - by Luca
    Hi! I'm using the Android MediaProvider application to get information regarding the resources registered in the media library. The only way I found to do this is to use the ContentProvider class provided by the MediaProvider application. Unfortunately, it seems to me this is quite a limitation, isn't it? Is it possible this way to create complex queries with subqueries and using other functions of SQLite? I thought that it may be possible using the SQLiteDatabase class, but it seems it is not possible to open the database directly with its path, and anyway, the query method seems not to allow subqueries. Any solution to this? Thanks!

    Read the article

  • Compiled Queries and "Parameters cannot be sequences"

    - by David B
    I thought that compiled queries would perform the same query translation as DataContext. Yet I'm getting a run-time error when I try to use a query with a .Contains method call. Where have I gone wrong? //private member which holds a compiled query. Func<DataAccess.DataClasses1DataContext, List<int>, List<DataAccess.TestRecord>> compiledFiftyRecordQuery = System.Data.Linq.CompiledQuery.Compile <DataAccess.DataClasses1DataContext, List<int>, List<DataAccess.TestRecord>> ((dc, ids) => dc.TestRecords.Where(tr => ids.Contains(tr.ID)).ToList()); //this method calls the compiled query. public void FiftyRecordCompiledQueryByID() { List<int> IDs = GetRandomInts(50); //System.NotSupportedException //{"Parameters cannot be sequences."} List<DataAccess.TestRecord> results = compiledFiftyRecordQuery (myContext, IDs); }

    Read the article

  • Linq To Sql: Compiled Queries and Extension Methods

    - by Beni
    Hi community, I'm interessted, how does Linq2Sql handles a compiled query, that returns IQueryable. If I call an extension method based on a compiled query like "GetEntitiesCompiled().Count()" or "GetEntitiesCompiled().Take(x)". What does Linq2Sql do in the background? This would be very bad, so in this situation I should write a compiled query like "CountEntitiesCompiled". Does he load the result (in this case "GetEntitiesCompiled()") into the memory (mapped to the entity class like "ToList()")? So what situations make sense, when the compiled queries return IQueryable, that query is not able to modify, before request to the Sql-Server. So in my opinion I can just as good return List. Thanks for answers!

    Read the article

  • Using a table-alias in Kohana queries?

    - by Aristotle
    I'm trying to run a simple query with $this->db in Kohana, but am running into some syntax issues when I try to use an alias for a table within my query: $result = $this->db ->select("ci.chapter_id, ci.book_id, ci.chapter_heading, ci.chapter_number") ->from("chapter_info ci") ->where(array("ci.chapter_number" => $chapter, "ci.book_id" => $book)) ->get(); It seems to me that this should work just fine. I'm stating that "chapter_info" ought to be known as "ci," yet this isn't taking for some reason. The error is pretty straight-forward: There was an SQL error: Table 'gb_data.chapter_info ci' doesn't exist - SELECT `ci`.`chapter_id`, `ci`.`book_id`, `ci`.`chapter_heading`, `ci`.`chapter_number` FROM (`chapter_info ci`) WHERE `ci`.`chapter_number` = 1 AND `ci`.`book_id` = 1 If I use the full table name, rather than an alias, I get the expected results without error. This requires me to write much more verbose queries, which isn't ideal. Is there some way to use shorter names for tables within Kohana's query-builder?

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >