Search Results

Search found 17240 results on 690 pages for 'query'.

Page 19/690 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • mysql query - blog posts and comments with limit

    - by Lemon
    Hi, I have 2 tables: comments and posts and I'd like to display a list of 15 posts and maximum 2 most recent comments under each blog post the database scheme looks like this posts_table: post_id, post_txt, post_timestamp comments_table: post_id, comment_txt, comment_timestamp how the mysql query should look like to select 15 posts and related comments (max 2 most recent ones per post) ??? thanks, Leo

    Read the article

  • how does a sql query work?

    - by Anand
    Hi, How does a sql query work ? how does it get compiled ? Is the from clause complied first to see if the table exists ? How does it actually retrieve data from the database ? How and in what format are the tables stored in a database ? I am using phpmyadmin is there anyway I can peek into the files where data is stored ??

    Read the article

  • Sql-server Database query help

    - by menacheb
    Hi, I have a Database (Sql-server) with table named 'ProcessData' and columns named 'Process_Name' (Data Type: nvarchar(50)), 'Start_At' (DataType: DateTime) and 'End_At' (Data Type: DateTime). I need to konw for each 'Time-Interval' (let's say 1 second) how many processes (Process_Name = PN) was open (after or equal to the 'Start_at' column and before or equal to the 'End_At' column) during this time (It can be a few rows with the same data). Does anyone know how to make this query? Many thanks,

    Read the article

  • same table, 1 field to 2 field query

    - by edib
    I have 2 tables: 1st holds employees (of ones in any position) and the 2nd holds manager employee relations with id numbers. I want to write a query like 1st field: name(employee), 2nd field: name(manager) How can I do that?

    Read the article

  • LINQ dynamic query

    - by ile
    How to dynamically generate LINQ query: int[] IDArray = {55, 36}; public IQueryable<ContactListView> FindAllContacts(int loggedUserID, int[] IDArray) { var result = ( from contact in db.Contacts //Start of dynamic part... where contact.UserID == loggedUserID foreach (var id in IDArray) { where contact.UserID == id } // End of dynamic part orderby contact.ContactID descending select new ContactListView { ContactID = contact.ContactID, FirstName = contact.FirstName, LastName = contact.LastName }); return result; } Thanks, Ile

    Read the article

  • App engine JPA date query

    - by waney
    Hi There. Assume I have object which represents TASK. Task have due date. How do I create query to get all tasks which are due today? Some working code like "select t from Task t where dueDate=:today" will be usefull. Thank you in advance.

    Read the article

  • How to create Query syntax for multiple DataTable for implementing IN operator of Sql Server

    - by Shantanu Gupta
    I have fetched 3-4 tables by executing my stored procedure. Now they resides on my dataset. I have to maintain this dataset for multiple forms and I am not doing any DML operation on this dataset. Now this dataset contains 4 tables out of which i have to fetch some records to display data. Data stored in tables are in form of one to many relationship. i.e. In case of transactions. N records per record. Then these N records are further mapped to M records of 3rd table. Table 1 MAP_ID GUEST_ID DEPARTMENT_ID PARENT_ID PREFERENCE_ID -------------------- -------------------- -------------------- -------------------- -------------------- 19 61 1 1 5 14 61 1 5 15 15 61 2 4 10 18 61 2 13 23 17 61 2 20 26 16 61 40 40 41 20 62 1 5 14 21 62 1 5 15 22 62 1 6 16 24 62 2 3 4 23 62 2 4 9 27 62 2 13 23 25 62 2 20 24 26 62 2 20 25 28 63 1 1 5 29 63 1 1 8 34 63 1 5 15 30 63 2 4 10 33 63 2 4 11 31 63 2 13 23 32 63 40 40 41 35 65 1 NULL 1 36 65 1 NULL 1 38 68 2 13 22 37 68 2 20 25 39 68 2 23 27 40 92 1 NULL 1 Table 2 Department_ID Department_Name Parent_Id Parent_Name -------------------- ----------------------- --------------- ---------------------------------------------------------------------------------- 1 Food 1, 5, 6 Food, North Indian, South Indian 2 Lodging 3, 4, 13, 20, 23 Room, Floor, Non Air Conditioned, With Balcony, Without Balcony 40 New 40 SubNew TABLE 3 Parent_Id Parent_Name Preference_ID Preference_Name -------------------- ----------------------------------------------- ----------------------- ------------------- NULL NULL NULL NULL 1 Food 5, 8 North Indian, Italian 3 Room 4 Floor 4 Floor 9, 10, 11 First, Second, Third 5 North Indian 14, 15 X, Y 6 South Indian 16 Dosa 13 Non Air Conditioned 22, 23 With Balcony, Without Balcony 20 With Balcony 24, 25, 26 Mountain View, Ocean View, Garden View 23 Without Balcony 27 Mountain View 40 New 41 SubNew I have these 3 tables that are related in some fashion like this. Table 1 will be the master for these 2 tables i.e. table 2 and table 3. I need to query on them as SELECT Department_Id, Department_Name, Parent_Name FROM Table2 WHERE Department_Id in ( SELECT Department_Id FROM Table1 WHERE guest_id=65 ) SELECT Parent_Id, Parent_Name, Preference_Name FROM Table3 WHERE PARENT_ID in ( SELECT parent_id FROM Table1 WHERE guest_id=65 ) Now I need to use these queries on DataTables. So I am using Query Syntax for this and reached up to this point. var dept_list= from dept in DtMapGuestDepartment.AsEnumerable() where dept.Field<long>("PK_GUEST_ID")==long.Parse(63) select dept; This should give me the list of all departments that has guest id =63 Now I want to select all departments_name and parent_name from Table 2 where guest_id=63 i.e. departments that i fetched above. This same case will be followed for Table3. Please suggest how to do this. Thanks for keeping up patience for reading my question.

    Read the article

  • parametrized query jqgrid

    - by user300657
    Hey, I have this mysql tables I want to display with jqgrid. The problem appears when I want to display a parametrized query. For example lets say I want to display all students older than 21. I have this variable named age which I want to pass to server.php file where I can construct the XML or JSON. On server I see some variables like $examp = $_REQUEST["q"]; but I dont know where to put $age to be accesed in server.php Thanks

    Read the article

  • Sql query to get the GrandFather name by doing a self join

    - by mahesh
    Hello all , Can any one please give me the query to get the child name and his grand fathers name For eg - if i have a table Relationships in the i have childid and fatherid columns so how will i get the grandfather, i can easily get the father name by using a join but for grandfather i need to do joins 2 times so can any one help me with this D.Mahesh

    Read the article

  • Retrieve data using Dynamic Query and Linq to SQL

    - by GigaPr
    Hi I have a really complicated dynamic query that i want to use to retrieve data from the database I am working in .net 3.5 sql server 2008 i created a stored procedure that accepts a varchar(max) as input parameter and does execute (@SqlQuery) it executes but does not return anything I really would like to use LINQ as all my project is implemented using linq Any Idea how to do it what is the problem?

    Read the article

  • MYSQL update query php

    - by bell
    I am trying to use an update query to change values held in a database, the new values I am trying to store are held in php variables. I'm not sure what it is I'm doing wrong. mysql_query("UPDATE user SET status='full' WHERE user_id = '$user_id'")or die(mysql_error()); thanks in advance

    Read the article

  • hiberate named query variable schema name

    - by Sandeep Jindal
    Hi, Other than default schema, for some SQL queries I need to access a particular schema. The issue is that the name of that particular schema is different for different environments. After goggling I found that using this link I am able to specify the schema name in variable. If that’s true that I have following questions: Will that would for SQL queries in the named query? How to set the value for the variable names? Thanks in advance.

    Read the article

  • mysql query for getting all messages that belong to user's contacts

    - by aharon
    So I have a database that is setup sort of like this (simplified, and in terms of the tables, all are InnoDBs): Users: contains based user authentication information (uid, username, encrypted password, et cetera) Contacts: contains two rows per relationship that exists between users as (uid1, uid2), (uid2, uid1) to allow for a good 1:1 relationship (must be mutual) between users Messages: has messages that consist of a blob, owner-id, message-id (auto_increment) So my question is, what's the best MySQL query to get all messages that belong to all the contacts of a specific user? Is there an efficient way to do this?

    Read the article

  • MySQL query to view vertical data

    - by wenkhairu
    I have MySQL data that looks like this: +----------------------------------------+ |Name | kode | jum | +----------------------------------------+ | aman |kode1 | 2 | | aman |kode2 | 1 | | jhon |kode1 | 4 | | amir |kode2 | 4 | +--------------------+-----------+-------+ How can I make the table look like this one, using a MySQL query? kode1 kode2 count aman 2 1 3 jhon 0 4 4 amir 0 4 4

    Read the article

  • how to use the order by and aggregate function together in sql query

    - by Ranjana
    SELECT count(distinct req.requirementid), req.requirementid, org.organizationid,req. locationofposting,org.registereddate FROM OrganizationRegisteredDetails AS org, RequirementsDetailsforOrganization AS req WHERE org.organizationid =req.requirementid order by org.RegisteredDate desc this shows me the error : Column 'RequirementsDetailsforOrganization.RequirementID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. how to do the 'order by org.RegisteredDate desc' in this Query ....

    Read the article

  • Why is postgresql update query so slow sometimes, even with index

    - by Matija
    i have a simple update query (foo column type is BOOLEAN (default false)): update tablename set foo = true where id = 234; which "id" is set to (primary) key, and if i run "explain analyze" i got: Index Cond: (id = 234) Total runtime: 0.358 ms but still, i have plenty of unexplained queries at slow log (pgfouine), which took more than 200s (?!): Times executed: 99, Av. duration (s): 70 can anyone please explain, whats the reason for that? (1.5 mio rows in table, postgresql 8.4)

    Read the article

  • SQL Server query replace for MySQL Instruction

    - by pojomx
    Hi, I'm new to SQL Server, and used mysql for a while now... SELECT A.acol, IF(A.acol<0,"Neg","Pos") as Column2 From Table I want to do something like that on SQL Server, but there doesn't exist the IF instruction. How do I replace that if, in a SQL Server 2008 Query?

    Read the article

  • SQL query through an intermediate table

    - by Bryan
    Given the following tables: Recipes | id | name | 1 | 'chocolate cream pie' | 2 | 'banana cream pie' | 3 | 'chocolate banana surprise' Ingredients | id | name | 1 | 'banana' | 2 | 'cream' | 3 | 'chocolate' RecipeIngredients | recipe_id | ingredient_id | 1 | 2 | 1 | 3 | 2 | 1 | 2 | 2 | 3 | 1 | 3 | 3 How do I construct a SQL query to find recipes where ingredients.name = 'chocolate' and ingredients.name = 'cream'?

    Read the article

  • Java Shoutcast Query

    - by John
    Hi there, I have a Java IRC bot which i would like to query a shoutcast server and return basic information (song playing etc). Can someone guide me in the right direction? Thank you.

    Read the article

  • I want Oracle Query for Formatted Output

    - by reply2viveksshah
    The following is my table design: Ecode Degree YOQ 7654321 SSC 2000 7654321 HSC 2002 7654321 Bcom 2006 7654321 MCA 2010 7654322 SSC 2002 7654322 HSC 2004 7654322 Bcom 2007 7654323 SSC 2002 7654323 HSC 2004 7654323 BE 2008 I want the following formatted output using an oracle query: Ecode Degree year 7654321 SSC,HSC,Bcom,MCA 2000,2002,2006,2010 7654322 SSC,HSC,Bcom 2002,2004,2007 7654323 SSC,HSC,BE 2002,2004,2008 How can this be done?

    Read the article

  • How to pass output of a linq query to another form in C#

    - by Ani
    I have a Linq query and I want to pass the ouput (userid) to another form for further processing. var userid = from auser in allusers.Users where auser.Username == nameString select new { id = auser.UserId }; so only 'UserId' is stored in variable 'userid' and I want to use this value in another form. Is there any way we can do this. Thanks, Ani

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >