Search Results

Search found 12683 results on 508 pages for 'row sun'.

Page 63/508 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • SQL: Limit rows linked to each joined row

    - by SolidSnakeGTI
    Hello, I've certain situation that requires certain result set from MySQL query, let's see the current query first & then ask my question: SELECT thread.dateline AS tdateline, post.dateline AS pdateline, MIN(post.dateline) FROM thread AS thread LEFT JOIN post AS post ON(thread.threadid = post.threadid) LEFT JOIN forum AS forum ON(thread.forumid = forum.forumid) WHERE post.postid != thread.firstpostid AND thread.open = 1 AND thread.visible = 1 AND thread.replycount >= 1 AND post.visible = 1 AND (forum.options & 1) AND (forum.options & 2) AND (forum.options & 4) AND forum.forumid IN(1,2,3) GROUP BY post.threadid ORDER BY tdateline DESC, pdateline ASC As you can see, mainly I need to select dateline of threads from 'thread' table, in addition to dateline of the second post of each thread, that's all under the conditions you see in the WHERE CLAUSE. Since each thread has many posts, and I need only one result per thread, I've used GROUP BY CLAUSE for that purpose. This query will return only one post's dateline with it's related unique thread. My questions are: How to limit returned threads per each forum!? Suppose I need only 5 threads -as a maximum- to be returned for each forum declared in the WHERE CLAUSE 'forum.forumid IN(1,2,3)', how can this be achieved. Is there any recommendations for optimizing this query (of course after solving the first point)? Notes: I prefer not to use sub-queries, but if it's the only solution available I'll accept it. Double queries not recommended. I'm sure there's a smart solution for this situation. I'm using MySQL 4.1+, but if you know the answer for another engine, just share. Appreciated advice in advance :)

    Read the article

  • Defining a function to a Row

    - by Siedrix
    Hi, im making an application and i need to implement diferent level of user permits. I coul have the function $this->view->users->hasPermits($this->view->user); By declaring a function on the model, an things could be easy to implement. But i would like to be able to have the next function doing the same: $this->view->user->hasPermits(); Is there a way to do this? do i need to extend the Zend_Db_Table_Row class? any ideas?

    Read the article

  • Expanding a row in a div-based table

    - by magneticMonster
    I have a stack of <div> elements that show a name. I'd like to include a + link off to the side that, when clicked, expands the <div> and adds more detailed information (from a RoR controller). After poking around on the net, I found link_to_remote and related RoR stuff, but I can't seem to get the right combination to work together. Can someone point me to a tutorial or show what the controller and view interaction should look like? Thanks!

    Read the article

  • oracle query returns 4 duplicates of each row

    - by ajoe
    hello, I am Running a oracle query, it seems to work except that it returns 4 dupes of each result. here is the code: Select * from (Select a.*, rownum rnum From (SELECT NEW_USER.*, NEW_EHS_QUIZ_COMPLETE.datetime FROM NEW_USER, NEW_EHS_QUIZ_COMPLETE WHERE EXISTS(select * from NEW_EHS_QUIZ_COMPLETE where NEW_USER.id=NEW_EHS_QUIZ_COMPLETE.USER_ID) ORDER by last_name ASC ) a where rownum <= #pgtop# ) where rnum >= #pgbot# does anyone know why this isnt working properly? thanks in advance.

    Read the article

  • Hibernate 1:M relationship ,row order, constant values table and concurrency

    - by EugeneP
    table A and B need to have 1:M relationship a and b are added during application runtime, so A created, then say 4 B's created. Each B instance has to come in order, so that I could later extract them in the same order as I added them. The app will be a web-app running on Tomcat, so 10 instances may work simultaneously. So my question are: 1) How to preserve inserting order, so that I could extract B instances that A references in the same order as I persisted them. That's tricky, because we add to a Collection and then it gets saved (am I right?). So, it depends on how Hibernate saves it, what if it changes the order in what we added instances? I've seen something like LIST instead of SET when describing relationships, is that what I need? 2) How to add a 3-rd column to B so that I could differentiate the instances, something like SEX(M,F,U) in B table. Do I need a special table, or there's and easy way to describe constants in Hibernate. What do you recommend? 3) Talking about concurrency, what methods do you recommend to use? There should be no collisions in the db and as you see, there might easily be some if rows are not inserted (PK added) right where it is invoked without delays ?

    Read the article

  • MySQL select date, join statistic data - how?

    - by Webnet
    I have some statistics I need to report on a monthly basis. I need my query to return 0's for statistics which aren't there. The only way I know to do this is to use SQL to generate a list of days within the specified time period and LEFT JOIN the statistic data that I need to report on. Problem is.... I've never not selected from a table like that... how do I do that?

    Read the article

  • jQuery Find Previous Table Row that has a Cell with a Specific Class

    - by Huy Tran
    Hello All, Suppose I have a table like so: <table> <tr><td class="this-is-a-label">Label Cell</td></tr> <tr><td>Detail 1</td></tr> <tr><td class="selected">Detail 2</td></tr> </table> I want to be able to grab the previous "Label Cell" from the "Selected" cell. My jQuery script should be something like: $('.selected').each(function() { var label = $(this).parent().prev('tr td.this-is-a-label'); //... do what I need with the label ... }); But it's not working. Does anyone have any suggestions? Thanks.

    Read the article

  • SQL grouping query question; evaluating a group of rows based on the value of one field.

    - by user324575
    I've got table vendorparts that lists all my parts and their vendor(s). Parts with multiple vendors have multiple records in this table. I'm trying to write a query that only returns the partid, and vendor of parts that do not have a default vendor assigned. Partid Vendor Defaultflag 1 A 1 2 B 0 2 C 0 3 D 0 3 E 0 3 F 1 4 G 0 I would like to return the following: Partid Vendor 2 A 2 B 4 G I'm obviously having issues with partid 3 and getting the query to see it as having a default vendor assigned.

    Read the article

  • Creating a row of Three Boxes Seperated

    - by Frank G.
    I am new to css and I have a menu bar that I am working on however I am having a problem with one of the menu ("LINKS") items. If you roll over the Links menu item your notice I have three boxes there that I am trying to separate into there own area. Right now they are over lapping each other. Could you please tell me what I am doing wrong? I have tried margin-left and padding-left and I find that they either move the box further to the right or widen the box more. But they don't space them out. You can find the menu bar here: http://jsfiddle.net/vtjPR/

    Read the article

  • adding count( ) column on each row

    - by Arsenal
    I'm not sure if this is even a good question or not. I have a complex query with lot's of unions that searches multiple tables for a certain keyword (user input). All tables in which there is searched are related to the table book. There is paging on the resultset using LIMIT, so there's always a maximum of 10 results that get withdrawn. I want an extra column in the resultset displaying the total amount of results found however. I do not want to do this using a seperate query. Is it possible to add a count() column to the resultset that counts every result found? the output would look like this: ID Title Author Count(...) 1 book_1 auth_1 23 2 book_2 auth_2 23 4 book_4 auth_.. 23 ... Thanks!

    Read the article

  • set label text to total row count of gridview

    - by woolardz
    I'm using a stored procedure in a sql database as the data source for a SqlDataSourceControl on my .aspx page. I'm then using the SqlDataSourceControl as the data source for a gridview on my page. Paging is set to true on the gridview. What i would like to do is set the text of a label to the total number of rows in the gridview. I can use this code 'labelRowCount.Text = GridView2.Rows.Count & " layers found" to return the number of results per page, but it doesn't give me the total. I've looked in several places and haven't been successful in finding a solution.

    Read the article

  • Multiple row insertion in a faster way

    - by Cyborgo
    Hi, I am using rails and I am trying to insert new rows into the table. The data comes from a text file and I created hash with one of the attribute as key. Then I find all the keys that are currently not in the table. Then I need to insert all of them into the table with all the attributes that I saved in hash. newvals.each{ |x| author = Author.create(:first => x, :second => hash[x][0], :third => hash[x][1]) author.save } This has lot of overhead as it makes an SQL update one at time. The newals array is usually quite big around the size of 20-30k. I know create can insert multiple objects at once, but I cant seem to figure out how. Is there any way to get this done. Thanks.

    Read the article

  • Mysql multiple row count?

    - by Steven
    Hello, I have a database full of rows like id,action,date 2,2,2010-03-01 3,2,2010-03-01 4,3,2010-03-01 5,3,2010-03-01 6,4,2010-02-01 7,4,2010-02-01 And I want to select all the count all the 2's and all the 3's and all the 4's. But I don't want to have to do 3 different SELECT COUNT() commands, is there a way to do this in a single command? Note, I want to display this as something like Action 2 = 2 Action 3 = 2 Action 4 = 2 (etc etc). And I will also need to specific a date (so it only counts all the 2,3,4,etc for dates between 2010-02-03 and 2010-03-01 for example)

    Read the article

  • How to predict result set row count?

    - by Saurabh Kumar
    I have an application where I create a big SQL query dynamically for SQL server 2008. This query is based on various search criteria which the user might give such as search by lastname, firstname, ssn etc. The requirement is that if the user gives a condition due to which the formed query might return a lot of rows(configurable for max N rows), then the application must send back a message instead to the user saying that he needs to refine his search query as the existing query will return too many rows. I would not want to bring back say, 5000 rows to the client and then discard that data just to show the user an error. What is an efficient way to tackle this issue?

    Read the article

  • SQL - Add up all row-values of one column in a singletable

    - by ThE_-_BliZZarD
    Hello Everybody, I've got a question regarding a SQL-select-query: The table contains several columns, one of which is an Integer-column called "size" - the task I'm trying to perform is query the table for the sum of all rows (their values), or to be more exact get a artifical column in my ResultSet called "overallSize" which contains the sum of all "size"-values in the table. Preferable it would be possible to use a WHERE-clause to add only certain values ("WHERE bla = 5" or something similar). The DB-engine is HSQLDB (HyperSQL), which is compliant to SQL2008. Thank you in advance :)

    Read the article

  • Targeting row when responding with js rails

    - by berto77
    I have an application where a user can vote on reviews. They can vote up or down. Now when there's a listing of reviews, I have a problem targeting the review the user voted on. I'm using a respon_to block in my rails controller and responding with js. So for instance, I have a vote_up method, and a vote_up.js.erb template. in that template, I have the following: var id = $('article.comment').attr('id').split('_')[1]; alert("id: " + id); $('.votecomment_' + id).find('.score').html("<%= @review2.vote_total %>"); I'm just alerting the id. The problem is that the id always returns the value of the first review found on the page. How can I pass the context aka this, to javascript, so I can figure out which review to target?

    Read the article

  • Row for each hour even if there is no record

    - by peku33
    I've got a trouble with creating mysql Query. My PHP script executes this query on each run: INSERT INTO Executes SET UserIp='%s' (%s is user IP) Executes table is: ExecuteId UNSIGNED BIGINT AI PRIMARY Date TIMESTAMP DEFAULT CURRENT_TIMESTAMP INDEX UserIp CHAR(24) ... | Some Columns I want to retrive number of Executes in each hour. The most obvious solution would be: SELECT COUNT(*) as ExecutesNum, DATE(Date) as D, HOUR(Date) as H GROUP BY D, H And it works, BUT it does not create rows for hours where there were no executes. What should I modify to get result like: 1 | 2012-09-01 | 14 **0 | 2012-09-01 | 15** 11 | 2012-09-01 | 16 1 | 2012-09-01 | 17

    Read the article

  • Insert a row and avoiding race condition (PHP/MySQL)

    - by justkevin
    I'm working on a multiplayer game which has a lobby-like area where players select "sectors" to enter. The lobby gateway is powered by PHP, while actual gameplay is handled by one or more Java servers. The datastore is MySQL. The happy path: A player chooses a sector and tells the lobby he'd like to enter. The lobby checks whether this is okay, including checking whether there are too many players in the sector (compares the entry count in sector assignments for that sector against the sector's max_players value). The player is added to the sector_assignments table pairing him with the sector. The player client receives a passkey that will let him connect to the appropriate game server. The race condition: If two players request access to the same sector at close to same time, I can envision a case where they are both added because there was one space free when their check was started and max players gets exceeded. Is the best solution LOCK TABLE on sector_assignments? Is there another option?

    Read the article

  • How to extract the latest row

    - by Bob
    Hi, I have a table like this: Table A Date Time ID Ref 110217 91703 A001 A1100056 110217 91703 A001 A1100057 110217 91703 A001 A1100058 110217 91703 A001 A1100059 110217 132440 A001 A1100057 110217 132440 A001 A1100058 110217 132440 A001 A1100060 I wish to have the latest data only & the final result should look like this using SQL: Date Time ID Ref 110217 132440 A001 A1100057 110217 132440 A001 A1100058 110217 132440 A001 A1100060 The database will self-update by itself at certain time. The problem is: I do not know the exact time, hence I do not know which record is the latest. Thanks.

    Read the article

  • Unable to change two things about a single row in mysql with php

    - by user1624005
    Here's the code: $id = intval($_POST['id']); $score = "'" . $_POST['score'] . "'"; $shares = "'" . $_POST['shares'] . "'"; $conn = new PDO('mysql:host=localhost;dbname=news', 'root', ''); $stmt = $conn->prepare("UPDATE news SET 'shares' = :shares, 'score' = :score WHERE id = :id"); $stmt -> execute(array( 'shares' => $shares, 'score' => $score, 'id' => $id )); And it doesn't work. I am unsure as to how I would see the error that I assume mysql is giving somewhere, and I've tried everything I could think of. Using double quotes and adding the variables into the statement right away. Adding single quotes to shares and score. How am I supposed to be doing this?

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >