Search Results

Search found 12215 results on 489 pages for 'identity column'.

Page 74/489 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • Calculate the SUM of the Column which has Time DataType:

    - by thevan
    I want to calculate the Sum of the Field which has Time DataType. My Table is Below: TableA: TotalTime ------------- 12:18:00 12:18:00 Here I want to sum the two time fields. I tried the below Query SELECT CAST( DATEADD(MS, SUM(DATEDIFF(MS, '00:00:00.000', CONVERT(TIME, TotalTime))), '00:00:00.000' ) AS TOTALTIME) FROM [TableA] But it gives the Output as TOTALTIME ----------------- 00:36:00.0000000 But My Desired Output would be like below: TOTALTIME ----------------- 24:36:00 How to get this Output?

    Read the article

  • Update multiple table column values using single query

    - by Dave Jarvis
    How would you update data in multiple tables using a single query? In MySQL it would be: UPDATE party p LEFT JOIN party_name n ON p.party_id = n.party_id LEFT JOIN party_details d ON p.party_id = d.party_id LEFT JOIN incident_participant ip ON ip.party_id = p.party_id LEFT JOIN incident i ON ip.incident_id = i.incident_id SET p.employee_id = NULL, c.em_address = '[email protected]', c.ad_postal = 'x', n.first_name = 'x', n.last_name = 'x' WHERE i.confidential_dt IS NOT NULL What is the equivalent SQL statement using Oracle 11g? (Is ANSI SQL possible?) Thank you!

    Read the article

  • Unknown Column?

    - by Kenny
    ok im trying to get mutual friends between these Two users, user1 and user92 This is the sql that is successful in displaying them SELECT IF(user_a = 1 OR user_a = 92, user_b, user_a) friend FROM friendship WHERE (user_a = 1 OR user_a = 92) OR (user_b = 1 OR user_b = 92) GROUP BY 1 HAVING COUNT(*) > 1 THis is how it looks friend 61 72 73 74 75 76 77 78 79 80 81 So now i want to select all users after the number 72, and i try to do it with this sql but its not working? It gives me the error, "unknown coulum name friend in where clause" SELECT IF(user_a = 1 OR user_a = 92, user_b, user_a) friend FROM friendship WHERE friend > 72 and (user_a = 1 OR user_a = 92) OR (user_b = 1 OR user_b = 92) GROUP BY 1 HAVING COUNT(*) > 1 what am i doing wrong? or what is the correct way?? thx

    Read the article

  • Rearrange a python list into n lists, by column

    - by Ben R
    Trying to solve this at this hour has gotten my mind into a tail-spin: I want to rearrange a list l into a list of n lists, where n is the number of columns. e.g., l = [1,2,3,4,5,6,7,8] n = 5 ==> [[1,6][2,7][3,8][4][5]] another example: l = [1,2,3,4,5,6,7,8,9,10] n = 4 ==> [[1,5,9],[2,6,10],[3,7][4,8] Can someone please help me out with an algorithm? Feel free to use any python awesomeness that's available; I'm sure theres some cool mechanism that's a good fit for this, i just can't think of it.

    Read the article

  • MySQL - get all unique values of a column, check if has a specific value

    - by gamers2000
    First off - apologies for the poor title, I have no idea how to describe it in a one-liner. I have a table - snippet is below. mysql> select * from playlistfiles; +-----------------------+--------------+-----------+ | FileName | PlaylistName | FileIndex | +-----------------------+--------------+-----------+ | File1 | Image1 | 0 | | File1 | Video1 | 2 | | File2 | Video1 | 0 | | File3 | Video1 | 1 | | File4 | Image1 | 1 | | File4 | Video1 | 3 | +-----------------------+--------------+-----------+ 6 rows in set (0.00 sec) What I need to do is to get all the FileNames and whether the file is in a playlist or not, as well as order them by FileIndex i.e. for the Image1 playlist, the output should be +-----------------------+------------+-----------+ | FileName | InPlaylist | FileIndex | +-----------------------+------------+-----------+ | File1 | 1 | 0 | | File2 | 0 | Null | | File3 | 0 | Null | | File4 | 1 | 1 | +-----------------------+------------+-----------+ and Video1 would be +-----------------------+------------+-----------+ | FileName | InPlaylist | FileIndex | +-----------------------+------------+-----------+ | File2 | 1 | 0 | | File3 | 1 | 1 | | File1 | 1 | 2 | | File4 | 1 | 3 | +-----------------------+------------+-----------+ In short, I need to be able to get all the unique FileNames from the table, and check if it is in a given table and if so, order it by FileIndex.

    Read the article

  • T-SQL Query, combine columns from multiple rows into single column

    - by Shayne
    I have seeen some examples of what I am trying to do using COALESCE and FOR XML (seems like the better solution). I just can't quite get the syntax right. Here is what I have (I will shorten the fields to only the key ones): Table Fields ------ ------------------------------- Requisition ID, Number IssuedPO ID, Number Job ID, Number Job_Activity ID, JobID (fkey) RequisitionItems ID, RequisitionID(fkey), IssuedPOID(fkey), Job_ActivityID (fkey) I need a query that will list ONE Requisition per line with its associated Jobs and IssuedPOs. (The requisition number start with "R-" and the Job Number start with "J-"). Example: R-123 | "PO1; PO2; PO3" | "J-12345; J-6780" Sure thing Adam! Here is a query that returns multiple rows. I have to use outer joins, since not all Requisitions have RequisitionItems that are assigned to Jobs and/or IssuedPOs (in that case their fkey IDs would just be null of course). SELECT DISTINCT Requisition.Number, IssuedPO.Number, Job.Number FROM Requisition INNER JOIN RequisitionItem on RequisitionItem.RequisitionID = Requisition.ID LEFT OUTER JOIN Job_Activity on RequisitionItem.JobActivityID = Job_Activity.ID LEFT OUTER JOIN Job on Job_Activity.JobID = Job.ID LEFT OUTER JOIN IssuedPO on RequisitionItem.IssuedPOID = IssuedPO.ID

    Read the article

  • sql jdbc getgeneratedkeys with mysql returns column "id" not found

    - by iamrohitbanga
    I want to retrieve the most recently updated value in the table using an insert query. these are the datatypes in my sql table. int(11) // primary key auto increment, not being assigned by sqlQuery varchar(30) timestamp // has a default value. but i am explicit assigning it using CURRENT_TIMESTAMP varchar(300) varchar(300) varchar(300) int(11) varchar(300) // java code statement.executeUpdate(sqlQuery, Statement.RETURN_GENERATED_KEYS); ResultSet rs = statement.getGeneratedKeys(); System.out.println("here: " + rs.getMetaData().getColumnCount()); System.out.println("here1: " + rs.getMetaData().getColumnName(1)); // none of the following 3 works System.out.println("id: " + rs.getInt(1)); System.out.println("id: " + rs.getInt("GENERATED_KEY")); System.out.println("id: " + rs.getInt("id")); for a bit of background see this

    Read the article

  • row number over text column sort

    - by Marty Trenouth
    I'm having problems with dynamic sorting using ROW Number in SQL Server. I have it working but it's throwing errors on non numeric fields. What do I need to change to get sorts with Alpha Working??? ID Description 5 Test 6 Desert 3 A evil Ive got a Sql Prodcedure CREATE PROCEDURE [CRUDS].[MyTable_Search] -- Add the parameters for the stored procedure here -- Full Parameter List @ID int = NULL, @Description nvarchar(256) = NULL, @StartIndex int = 0, @Count int = null, @Order varchar(128) = 'ID asc' AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here Select * from ( Select ROW_NUMBER() OVER (Order By case when @Order = 'ID asc' then [TableName].ID when @Order = 'Description asc' then [TableName].Description end asc, case when @Order = 'ID desc' then [TableName].ID when @Order = 'Description desc' then [TableName].Description end desc ) as row, [TableName].* from [TableName] where (@ID IS NULL OR [TableName].ID = @ID) AND (@Description IS NULL OR [TableName].Description = @Description) ) as a where row > @StartIndex and (@Count is null or row <= @StartIndex + @Count) order by case when @Order = 'ID asc' then a.ID when @Order = 'Description asc' then a.Description end asc, case when @Order = 'ID desc' then a.ID when @Order = 'Description desc' then a.Description end desc END

    Read the article

  • SQLite SQLite column can't be updated to any value but zero (real type)

    - by user1065320
    Hi I'm trying to create a three fields table (date,text,real), I can insert and update the first two fields but can't set or update the last one. createSQL = @"CREATE TABLE IF NOT EXISTS ACTIVITIES (MYDATE DATETIME PRIMARY KEY, ACTIVITY TEXT , LENGTH REAL);"; try to insert char *update = "INSERT OR REPLACE INTO ACTIVITIES (MYDATE, ACTIVITY , LENGTH) VALUES (?, ? ,?);"; sqlite3_stmt *stmt; if (sqlite3_prepare_v2(database, update , -1, &stmt, nil) == SQLITE_OK) { sqlite3_bind_double(stmt, 1, valueToWrite); sqlite3_bind_text(stmt, 2, [task UTF8String], -1, NULL); sqlite3_bind_double(stmt, 3, 1.5); } if (sqlite3_step(stmt) != SQLITE_DONE) { NSAssert1(0, @"Error updating table: %s", errorMsg); } sqlite3_finalize(stmt); sqlite3_close(database); The first two values are updated but the last one remains 0 even if I'm writing a value like 1.5 or put a double variable with a different value Thanks

    Read the article

  • column data in tooltip overflows.

    - by xrx215
    I want to show the data in the tooltip when a columns has long sentences because of width constrints. for this i am using a renderer function as follows { header: xppo.st('SDE_INCIDENT_DESCRIPTION1'), width: 175, sortable: true, groupable: false, dataIndex: 'IncidentDescription', renderer: function(value, metaData, record, rowIndex, columnIndex, ds) { return '<div ext:qtip="' + value + '">' + value + '</div>'; } }, but when the data has no break space and when the word is really long the text will extend beyond the text area. how do i show the entire data within the div specified withot overflowing from it.

    Read the article

  • Creating an Order Column for encrypted data

    - by SetiSeeker
    I am saving encrypted data to a database. Is there a way I can create a "hashcode" or fingerprint or checksum of the plain text data, that if I sort / order by on the "hashcode" the order would be the same as if I had saved the plain text data and perform the same sort / order by operation on it? I basically need a SOUNDEX() type function that will give me a value that will maintain the order of the plain text data. I would then save both encrypted data and the "hashcode" and when querying the data order by the "hashcode" field. I need to perform this in the application and preferably not in the SQL DB if at all possible. I am using Entity Framework and SQL 2008 and C# 4.0.

    Read the article

  • AWK -- How to do selective multiple column sorting?

    - by nawesita
    In awk, how can I do this: Input: 1 a f 1 12 v 2 b g 2 10 w 3 c h 3 19 x 4 d i 4 15 y 5 e j 5 11 z Desired output, by sorting numerical value at $5: 1 a f 2 10 w 2 b g 5 11 z 3 c h 1 12 v 4 d i 4 15 y 5 e j 3 19 x Note that the sorting should only affecting $4, $5, and $6 (based on value of $5), in which the previous part of table remains intact.

    Read the article

  • Hibernate, select by id or unique column

    - by Nican
    I am using hibernate for Java, and I want to be able to select users by id or by name from the database. Nice thing about Hibernate is that it caches the result by id, but I seem to be unable to make it cache by name. static Session openSession = Factory.openSession(); public static User GetUser(int Id) { return (User) openSession.get(User.class, new Integer(Id)); } public static User GetUser( String Name ){ return (User) openSession.createCriteria( User.class ). add( Restrictions.eq("username", Name) ). uniqueResult(); } If I use GetUser(1) many times, hibernate will only show that it executed the first time. But every time I use GetUser("user1"), hibernate shows that it is executing a new query to database. What would be the best way to have the string identifier be cached also?

    Read the article

  • how to fetch & store any column from coredata to array

    - by user440485
    Hi All, I am working on page(Lesson) has button called "AddToFavorite". when i click on this button lessonID,lessonHeading is added in the Coredata. - (NSFetchedResultsController *)fetchedResultsController { // Set up the fetched results controller if needed. if (fetchedResultsController != nil) { return fetchedResultsController; } // Create the fetch request for the entity. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropriate. NSEntityDescription *entity = [NSEntityDescription entityForName:@"Favorites" inManagedObjectContext:managedObjectContext]; [fetchRequest setEntity:entity]; // Edit the sort key as appropriate. NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lessonHeading" ascending:YES]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [fetchRequest setSortDescriptors:sortDescriptors]; NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"lessonHeading" cacheName:@"Root"]; self.fetchedResultsController = aFetchedResultsController; self.fetchedResultsController.delegate = self; [aFetchedResultsController release]; [fetchRequest release]; [sortDescriptor release]; [sortDescriptors release]; return fetchedResultsController; } -(void)addToFavorites { UIAlertView *alert=[[UIAlertView alloc]initWithTitle:nil message:@"Lesson has been added successfully to your Favorite List" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; //Create a new managed object context for the new book -- set its persistent store coordinator to the same as that from the fetched results controller's context. NSManagedObjectContext *addingContext = [[NSManagedObjectContext alloc] init]; self.addingManagedObjectContext = addingContext; [addingManagedObjectContext setPersistentStoreCoordinator:[[fetchedResultsController managedObjectContext] persistentStoreCoordinator]]; Favorites *fav = [NSEntityDescription insertNewObjectForEntityForName:@"Favorites" inManagedObjectContext:addingContext]; fav.lessonID=[[data objectAtIndex:count]objectForKey:@"LessonID"]; fav.lessonTitle=[[data objectAtIndex:count]objectForKey:@"LessonTitle"]; [self didFinishWithSave:YES]; [addingContext release]; } My problem is that i want to show an alert if this lessonID is already existing in the coreData. show guide me how i can match the current page lessonID with the existing lessonID's in the CoreData. I am using CoreData 1st time.so sory for any mistake ...& thanks for ypur help frnds.

    Read the article

  • Multiple column subselect in mysql 5 (5.1.42)

    - by rubber boots
    This one seems to be a simple problem, but I can't make it work in a single select or nested select. Retrieve the authors and (if any) advisers of a paper (article) into one row. I order to explain the problem, here are the two data tables (pseudo) papers (id, title, c_year) persons (id, firstname, lastname) plus a link table w/one extra attribute (pseudo): paper_person_roles( paper_id person_id act_role ENUM ('AUTHOR', 'ADVISER') ) This is basically a list of written papers (table: papers) and a list of staff and/or students (table: persons) An article my have (1,N) authors. An article may have (0,N) advisers. A person can be in 'AUTHOR' or 'ADVISER' role (but not at the same time). The application eventually puts out table rows containing the following entries: TH: || Paper_ID | Author(s) | Title | Adviser(s) | TD: || 21334 |John Doe, Jeff Tucker|Why the moon looks yellow|Brown, Rayleigh| ... My first approach was like: select/extract a full list of articles into the application, eg.SELECT q.id, q.title FROM papers AS q ORDER BY q.c_year and save the results of the query into an array (in the application). After this step, loop over the array of the returned information and retrieve authors and advisers (if any), via prepared statement (? is the paper's id) from the link table like:APPLICATION_LOOP(paper_ids in array) SELECT p.lastname, p.firstname, r.act_role FROM persons AS p, paper_person_roles AS r WHERE p.id=r.person_id AND r.paper_id = ? # The application does further processing from here (pseudo): foreach record from resulting records if record.act_role eq 'AUTHOR' then join to author_column if record.act_role eq 'ADVISER' then join to avdiser_column end print id, author_column, title, adviser_column APPLICATION_LOOP This works so far and gives the desired output. Would it make sense to put the computation back into the DB? I'm not very proficient in nontrivial SQL and can't find a solution with a single (combined or nested) select call. I tried sth. like SELECT q.title (CONCAT_WS(' ', (SELECT p.firstname, p.lastname AS aunames FROM persons AS p, paper_person_roles AS r WHERE q.id=r.paper_id AND r.act_role='AUTHOR') ) ) AS aulist FROM papers AS q, persons AS p, paper_person_roles AS r in several variations, but no luck ... Maybe there is some chance? Thanks in advance r.b.

    Read the article

  • Unit Testing a CSV Parser and Column Mapping Tool

    - by PieterG
    I am really starting to enjoy unit testing and have the following question to the gurus of unit testing. Let's for example say I have the following class public class FileMapper { public Dictionary<string, string> ReadFile(string filename, string delimeter){} } How do you guys generally go about unit testing a Parser or ReadFile method in my case?

    Read the article

  • join 3 files by first Column with awk ?

    - by noinflection
    i have three similar files, they are all like this: File A ID1 Value1a ID2 Value2a . . . IDN Value2n and i want an output like this Output ID1 Value1a Value1b Value1c ID2 Value2a Value2b Value2c ..... IDN ValueNa ValueNb ValueNc Looking to the first line, i want value1A to be the value of id1 in fileA, value1B the value of id1 in fileB, and so on which each field and each line. I thougth it like a sql join. I've tried several things but none of them where even close.

    Read the article

  • MySQL: SELECT highest column value when WHERE finds similar entries

    - by Ike
    My question is comparable to this one, but not quite the same. I have a database with a huge amount of books, with different editions of some of the same book titles. I'm looking for an SQL statement giving me the highest edition number of each of the titles I'm selecting with a WHERE clause (to find specific book series). Here's what the table looks like: |id|title |edition|year| |--|-------------------------|-------|----| |01|Serie One Title One |1 |2007| |02|Serie One Title One |2 |2008| |03|Serie One Title One |3 |2009| |04|Serie One Title Two |1 |2001| |05|Serie One Title Three |1 |2008| |06|Serie One Title Three |2 |2009| |07|Serie One Title Three |3 |2010| |08|Serie One Title Three |4 |2011| |--|-------------------------|-------|----| The result I'm looking for is this: |id|title |edition|year| |--|-------------------------|-------|----| |03|Serie One Title One |3 |2009| |04|Serie One Title Two |1 |2001| |08|Serie One Title Three |4 |2011| |--|-------------------------|-------|----| The closest I got was using this statement: select id, title, max(edition), max(year) from books where title like "serie one%" group by name; but it returns the highest edition and year and includes the first id it finds: |--|-----------------------|-------|----| |01|Serie One Title One |3 |2009| |04|Serie One Title Two |1 |2001| |05|Serie One Title Three |4 |2011| |--|-----------------------|-------|----| This fancy join also comes close, but doesn't give the right result: select b.id, b.title, b.edition, b.year from books b inner join (select name, max(edition) as maxedition from books group by title) g on b.edition = g.maxedition where b.title like "serie one%" group by title; Using this I'm getting unique titles, but mostly old editions.

    Read the article

  • A column of a table needs to stay in one line (HTML/CSS/Javascript)

    - by Julien
    Hi Folks ! So I am having an issue on my entrepreneur business opportunity rating matrix : I would like the radio buttons to stay on the same line. The problem is that I don't know how I should process because if I give a fixed minimum width for the cell, i'm not sure it will display properly on other browsers, and if the cell is to big I loose the alignment of the radio buttons. Do you guys have a CSS/Javascript (jQuery) trick that would fix this ? Thank you

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >