Search Results

Search found 17583 results on 704 pages for 'query analyzer'.

Page 32/704 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • SQL query root parent child records

    - by Vish
    Hi, We have nested folders with parent-child relationship. We use MySQL MyISAM DB. The data is stored in the DB in the following manner. Every time a child folder is created in the nested structure, the previous parentID is added. I want to get the RootFolderID of a folder which is added in the hierarchy as tabulated below. FoldID ParentID |RootFolderID -----------------|------------------- 1 0 | 0 2 1 | 1 3 2 | 1 4 3 | 1 5 4 | 1 Please let me know how to get the root folderID and populate it in the RootFolderID column after a folder is created each time. Thanks.

    Read the article

  • Deceptive MySQL Query

    - by jerebear
    So I don't consider myself a novice at MySQL but this one has me stumped: I have a message board and I want to pull a list of all the most recent posts grouped by the Thread ID. Here's the table: MB_Posts -ID -Thread_ID -Created_On (timestamp) -Creator_User (user_id) -Subject -Contents -Edited (timestamp) -Reported I've tried many different things to keep it simple but I would like help from the community on this one. Just to kick this out there...this one does not work as expected: SELECT * FROM MB_Posts GROUP BY Thread_ID ORDER BY ID DESC

    Read the article

  • Best way to construct this query?

    - by Andrew
    I have two tables set up similar to this (simplified for the quest): actions- id - user_id - action - time users - id - name I want to output the latest action for each user. I have no idea how to go about it. I'm not great with SQL, but from what I've looked up, it should look something like the following. not sure though. SELECT `users`.`name`, * FROM users, actions JOIN < not sure what to put here > ORDER BY `actions`.`time` DESC < only one per user_id > Any help would be appreciated.

    Read the article

  • Why does this MySQL Query hang?

    - by zzapper
    SELECT * FROM tbl_order_head AS o INNER JOIN tbl_orders_log AS c ON o.PAYMENT_TRANSACTION_LOG_ID=c.TRANSACTION_ID WHERE o.VISUAL_ID = '77783'; tbl_order_head 67,000 (30 fields) records, tbl_orders_log 17000 (5 fields) records. I don't know if it would eventually return as I am running it on a live server and fear overloading. I am doing similar queries and much more complex queries successfully.

    Read the article

  • Oracle SQL Update query takes days to update

    - by B Senthil Kumar
    I am trying to update a record in the target table based on the record coming in from source. For instance, if the incoming record is present in the target table I would update them in the target else I would simply insert. I have over one million records in my source while my target has 46 million records. The target table is partitioned based on calendar key. I implement this whole logic using Informatica. I find that the Informatica code is perfectly fine looking at the Informatica session log but its in the update it takes long time (more than 5 days to update one million records). Any suggestions as to what can be done on the scenario to improve the performance?

    Read the article

  • problem in counting two fields in one query

    - by Mac Taylor
    hey guys i need to count new private messages and old one from a table so first thing come to mind is using mysql_num_rows and easy thing to do // check new pms $user_id = $userinfo['user_id']; $sql = "SELECT author_id FROM bb3privmsgs_to WHERE user_id='$user_id' AND (pm_new='1' OR pm_unread='1')"; $result = $db->sql_query($sql) ; $new_pms = $db->sql_numrows($result); $db->sql_freeresult($result); // check old pms $sql = "SELECT author_id FROM bb3privmsgs_to WHERE user_id='$user_id' AND (pm_new='0' OR pm_unread='0')"; $result = $db->sql_query($sql) ; $old_pms = $db->sql_numrows($result); $db->sql_freeresult($result); but how can i count these two fields just in one statement and shorter lines ?~

    Read the article

  • Recursive COUNT Query (SQL Server)

    - by Cosmo
    Hello Guys! I've two MS SQL tables: Category, Question. Each Question is assigned to exactly one Category. One Category may have many subcategories. Category Id : bigint (PK) Name : nvarchar(255) AcceptQuestions : bit IdParent : bigint (FK) Question Id : bigint (PK) Title : nvarchar(255) ... IdCategory : bigint (FK) How do I recursively count all Questions for a given Category (including questions in subcategories). I've tried it already based on several tutorials but still can't figure it out :(

    Read the article

  • Recursive COUNT Query (MS SQL)

    - by Cosmo
    Hello Guys! I've two MS SQL tables: Category, Question. Each Question is assigned to exactly one Category. One Category may have many subcategories. Category Id : bigint (PK) Name : nvarchar(255) AcceptQuestions : bit IdParent : bigint (FK) Question Id : bigint (PK) Title : nvarchar(255) ... IdCategory : bigint (FK) How do I recursively count all Questions for a given Category (including questions in subcategories). I've tried it already based on several tutorials but still can't figure it out :(

    Read the article

  • help! Linq query

    - by menon
    I am getting error msg on the word Records - Type or namespace could not be found. Please help debugging it, what is missing? if (ProjDDL1.SelectedItem.Value != "--") results = CustomSearch<Records>(results, s => s.Business == ProjDDL1.SelectedItem.Value); Method CustomSearch: private DataTable CustomSearch<TKEY>(DataTable dt, Func<Records, bool> selector) { DataTable results = (dt.AsEnumerable().Where(selector).CopyToDataTable()); return results; }

    Read the article

  • MySQL query for initial filling of order column

    - by Sejanus
    Sorry for vague question title. I've got a table containing huge list of, say, products, belonging to different categories. There's a foreign key column indicating which category that particular product belongs to. I.e. in "bananas" row category might be 3 which indicates "fruits". Now I added additional column "order" which is for display order within that particular category. I need to do initial ordering. Since the list is big, I dont wanna change every row by hand. Is it possible to do with one or two queries? I dont care what initial order is as long as it starts with 1 and goes up. I cant do something like SET order = id because id counts from 1 up regardless of product category and order must start anew from 1 up for every different category.

    Read the article

  • mySQL query : working with INTERVAL and CURDATE

    - by Tristan
    Hello, i'm building a chart and i want to recieve data for each months Here's my first request which is working : SELECT s.GSP_nom AS nom, timestamp, AVG( v.vote + v.prix ) /2 AS avg FROM votes_serveur AS v INNER JOIN serveur AS s ON v.idServ = s.idServ WHERE s.valide =1 AND v.date > CURDATE() -30 GROUP BY s.GSP_nom ORDER BY avg DESC But, in my case i've to write 12 request to recieve datas for the 12 previous months, is there any trick to avoid writing : // example for the previous month AND v.date > CURDATE() -60 AND v.date < CURDATE () -30 I heard about INTERVAL, i went to the mySQL doc but i didn't manage to implement it. Any ideas / example of using INTERVAL please ? Thank you

    Read the article

  • SQL query: Last but one rank for user

    - by Derk
    My table structure looks like this: create table rankings ( id IDENTITY NOT NULL, user_id INT NOT NULL, game_poule_id INT NOT NULL, rank INT NOT NULL, insertDate DATETIME NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, FOREIGN KEY (game_poule_id) REFERENCES game_poules(id) ON DELETE CASCADE ); All old rankings of users per game are saved in this table. Now I want to have the last but one rank in the table for all users in a gamepoule. Has someone an idea how to achive this? Thanks

    Read the article

  • NHibernate - using custom sql query for a column

    - by stacker
    Is there anyway to use custom sql with NHibernate? I want to use custom sql for a specific column. select id, viewsCount, commentsCount, 0.2 * viewsCount / (select top 1 viewsCount from articles where isActive = 1 order by viewsCount DESC) as priorityViews, 0.8 * commentsCount / (select top 1 commentsCount from articles where isActive = 1 order by commentsCount DESC) as priorityComments, round(0.2 * viewsCount / (select top 1 viewsCount from articles where isActive = 1 order by viewsCount DESC) + 0.8 * commentsCount / (select top 1 commentsCount from articles where isActive = 1 order by commentsCount DESC), 1) as priority from articles

    Read the article

  • Mysql query: count and distinct

    - by Azevedo
    I have this hypotetical MySQL table: TABLE cars: (year, color, brand) How do I count # of cars grouped by brand and year? I mean, how can I get to know how many colors are there grouped by brand like: brand "GM": total # of colors: 8. brand "GM": total # of years (grouped together): 14 (meaning there are count of 14 different years). brand "TOYOTA": total # of colors: 3. brand "TOYOTA": total # of years (grouped together): 10 (meaning there are count of 14 different years) I tried playing some queries with COUNT, DISTINCT, GROUP BY but I can't get to it. Actually I'm trying to get the 2 queries... +-------+---------------+ | brand | count(colors) | +-------+---------------+ +-------+--------------+ | brand | count(years) | +-------+--------------+ thanks a lot!

    Read the article

  • Php/Mysql - need help to insert and update multiple rows with a single query

    - by Guanche
    Hello, is there any way how in this situation insert and update DB with single queries? $message = 'Hello to all group members'; $userdata = mysql_query("SELECT memberid, membernick FROM members WHERE groupid='$cid'") or die('Error'); while(list($memberid, $membernick) = mysql_fetch_row($userdata)) { $result1 = mysql_query("INSERT INTO messages VALUES (NULL,'$membernick', '$memberid', '$message')") or die('Error'); $result2 = mysql_query("UPDATE users SET new_messages=new_messages+1, total_messages=total_messages+1 WHERE id='$memberid'") or die('Error'); }

    Read the article

  • MS Access query for time

    - by nisha
    following data and using MS Access with VB6 UserID UserName LogTime LogDate 1 S 9:00 21/5/2010 1 S 10:00 21/5/2010 1 S 11:00 21/5/2010 1 S 12:00 21/5/2010 1 S 14:00 21/5/2010 1 S 17:00 21/5/2010 Need Output as in below 6 columns:- 1 S 21/5/2010 9:00 21/5/2010 10:00 1 S 21/5/2010 11:00 21/5/2010 12:00 1 S 21/5/2010 14:00 21/5/2010 17:00

    Read the article

  • Help needed to construct a SQL query

    - by song202y
    Need your help to get the list of suggested friends (who aren't friends of the current user but are friends of 2 or more of the current user's friends). The primary ordering should put people at the same school at the top, and the secondary ordering should put people with more common friends (that is, the number of people who are friends of that person and the current user) near the top. Users: user_id PK, user_name Profiles: user_id PK, school_name, ... Friendships: id PK, user_id FK, friend_id FK Thank you in advance. Joe

    Read the article

  • PHP - SQL query to get update time from table status

    - by Tribalcomm
    This is my php code (I already have a connection to the db): $array = mysql_query("SHOW TABLE STATUS FROM mytable;"); while ($array = mysql_fetch_array($result)) { $updatetime = $array['Update_time']; } echo $updatetime; I get: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource. I am running MySQL 5.0.89 and PHP5. I do not want to add a new field to the table... I want to use the table status... Any help? Thanks!

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >