Search Results

Search found 6630 results on 266 pages for 'cname record'.

Page 92/266 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • GROUP BY and SUM distinct date across 2 tables

    - by kenitech
    I'm not sure if this is possible in one mysql query so I might just combine the results via php. I have 2 tables: 'users' and 'billing' I'm trying to group summed activity for every date that is available in these two tables. 'users' is not historical data but 'billing' contains a record for each transaction. In this example I am showing a user's status which I'd like to sum for created date and deposit amounts that I would also like to sum by created date. I realize there is a bit of a disconnect between the data but I'd like to some all of it together and display it as seen below. This will show me an overview of all of the users by when they were created and what the current statuses are next to total transactions. I've tried UNION as well as LEFT JOIN but I can't seem to get either to work. Union example is pretty close but doesn't combine the dates into one row. ( SELECT created, SUM(status) as totalActive, NULL as totalDeposit FROM users GROUP BY created ) UNION ( SELECT created, NULL as totalActive, SUM(transactionAmount) as totalDeposit FROM billing GROUP BY created ) I've also tried using a date lookup table and joining on the dates but the SUM values are being added multiple times. note: I don't care about the userIds at all but have it in here for the example. users table (where status of '1' denotes "active") (one record for each user) created | userId | status 2010-03-01 | 10 | 0 2010-03-01 | 11 | 1 2010-03-01 | 12 | 1 2010-03-10 | 13 | 0 2010-03-12 | 14 | 1 2010-03-12 | 15 | 1 2010-03-13 | 16 | 0 2010-03-15 | 17 | 1 billing table (record created for every instance of a billing "transaction" created | userId | transactionAmount 2010-03-01 | 10 | 50 2010-03-01 | 18 | 50 2010-03-01 | 19 | 100 2010-03-10 | 89 | 55 2010-03-15 | 16 | 50 2010-03-15 | 12 | 90 2010-03-22 | 99 | 150 desired result: created | sumStatusActive | sumStatusInactive | sumTransactions 2010-03-01 | 2 | 1 | 200 2010-03-10 | 0 | 1 | 55 2010-03-12 | 2 | 0 | 0 2010-03-13 | 0 | 0 | 0 2010-03-15 | 1 | 0 | 140 2010-03-22 | 0 | 0 | 150 Table dump: CREATE TABLE IF NOT EXISTS `users` ( `created` date NOT NULL, `userId` int(11) NOT NULL, `status` smallint(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `users` (`created`, `userId`, `status`) VALUES ('2010-03-01', 10, 0), ('2010-03-01', 11, 1), ('2010-03-01', 12, 1), ('2010-03-10', 13, 0), ('2010-03-12', 14, 1), ('2010-03-12', 15, 1), ('2010-03-13', 16, 0), ('2010-03-15', 17, 1); CREATE TABLE IF NOT EXISTS `billing` ( `created` date NOT NULL, `userId` int(11) NOT NULL, `transactionAmount` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `billing` (`created`, `userId`, `transactionAmount`) VALUES ('2010-03-01', 10, 50), ('2010-03-01', 18, 50), ('2010-03-01', 19, 100), ('2010-03-10', 89, 55), ('2010-03-15', 16, 50), ('2010-03-15', 12, 90), ('2010-03-22', 99, 150);

    Read the article

  • ios - almost there with updating Core Data

    - by Jeff Kranenburg
    I have been following the answer of this question: How to update existing object in core data? and in the answer it comes across this line of code to update a record within the array: Favorits* favoritsGrabbed = [results objectAtIndex:0]; Now this updates whatever is set a record 0 of the database, no matter what cell I select to edit. I am sorry but I cannot figure out how to change it into updating the cell I have selected. Starting to grow grey hairs here:-) The problem (maybe it is my mindset) is that I am required to give an integer and I am unable to find something to substitute it. Any help would be great.

    Read the article

  • Update if exists and insert if not

    - by user348731
    i have a very simple entity public class PortalStat { public virtual int ID { get; set; } public virtual Guid ProductGuid { get; set; } public virtual DateTime StatDateTime { get; set; } public virtual DM.Domain.Portal Portal { get; set; } public virtual int Count { get; set; } } i would like to make a funtion which check if there is a entity based on the Portal and the StatDateTime. if the record exist then i would like to increase the Count otherwise i would like to insert a new record. How do i do that in nhibernate

    Read the article

  • Find the period of over speed ?

    - by Vimvq1987
    Just something interesting come in my mind. Assume that we have a table (in SQL Server) like this: Location Velocity Time What is the best way to determine over speed periods (speed barrier is defined) ? My first idea was loading the table into an array, and then iterate over array to find these periods: (Pseudo C# code) bool isOverSpeed = false; for (int i =0;i<arr.Length;i++) { if (!isOverSpeed) if (arr[i].Velocity > speedBarrier) { #insert the first record into another array. isOverSpeed = true; } if(isOverSpeed) if (arr[i].Velocity < speedBarrier) { #insert the record into that array isOverSpeed = false; } } It works, but somewhat "not very effectively". Is there a "smarter" way, such as a T-SQL query or another algorithm to do this?

    Read the article

  • How to handle un-assigned records

    - by Mico
    I have this PHP page where the user can select and un-select items. The interface looks like this: Now I'm using these code, when the user hit the save changes button: foreach( $value as $al_id ){ //al_id is actually location id //check if a record exists //if location were assigned and leave it as is $assigned_count = $this->AssignedLoc->checkIfAssigned( $tab_user_id, $al_id ); if( $assigned_count == 0 ){ //else if not, insert this new record $this->insertAssigned( $tab_user_id, $company_id, $al_id ); } } Now my question is, how do I delete the un assigned locations? For example in the screenshot above, there are 4 assigned locations, if I'm gonna remove (or unassign) "Mercury Morong" and "GP Hagonoy" from the assigned locations, only two must remain. What are the possible solutions using PHP? Thanks for any help!

    Read the article

  • How listview delete data in database

    - by Bud33
    I have a problem to delete data in listview, I was able to delete data in listview select record, but data which selected is not deleted in the database, I have a source code Private _updateinputalltrans As Boolean Private Sub btndelete_Click(sender As System.Object, e As System.EventArgs) Handles btndelete.Click With Me.listviewpos.SelectedItem .Remove() End With MessageBox.Show("Are you sure delete this record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, New EventHandler(AddressOf DeleteData)) End Sub Private Sub DeleteData(ByVal sender As Object, ByVal e As EventArgs) Dim conn As New Connection(Connectiondb) If Me.updateinputalltrans = False Then If Me.listviewpos.Items.Count > 0 Then For Each del As ListViewItem In listviewpos.Items conn.delete_dtpospart(del.Text) Next End If End If End Sub delete_dtpospart a declare which connection to the database using a stored procedure

    Read the article

  • Reverse Data With BIT TYPE for MS SQL

    - by Milacay
    I have a column using a BIT type (1/0). I have some records are set to 1 and some are set to 0. Those are record flag needs to be reversed. So basically, I want all records with 1 set 0, and all records with 0 set to 1. If I run "Update Table1 Set Flag = 1 Where Flag = 0" first, then I am afraid all record flags will be 1 now, and will not able to know which ones are flag = 0. any suggestions, Thanks!

    Read the article

  • Removing groups of similar records in MySQL query

    - by user1182155
    I'm trying to wrap my head around this... (it may be simple, been a long day!) I have a database with sometimes multiple similar records... ie. Apples 2008-09-03 Apples 2012-01-01 Apples 2013-10-24 Oranges 2012-01-04 What I need to do is do a query that will show only records that haven't been updated today... So in this case, since Apples has an entry that was updated today, none of the records for the Apples should appear in the results. Oranges should be the only record it returns. I have a query similar to this... SELECT fruit FROM fruitnames where date < CURDATE() Which works to remove the record that was updated today... But it keeps the other records for Apples (obviously)... How would I remove those results as well?

    Read the article

  • Need help with jquery sorting

    - by Klerk
    I have a column within which are multiple 'records' (each a div). Each record has a bunch of fields (each a span whose id is the fieldname). I want to allow the user to sort all the records based on a field. I also want, the field that has been sorted to be moved to the beginning of the record. So I came up with this. But its really slow for a large sets. Not sure whats the best way to do this. Any ideas? $(".col1 div").sort( function (a,b) { if($(a).children("."+field).text() > $(b).children("."+field).text()) return -1; else return 1; }).appendTo(".col1");

    Read the article

  • dropdownlist format and then convert

    - by dinra
    i need a dropdownlist to show current month and year (January 2010) till January 2011, and an additional record of January 2011 +. But I want to save this in the database as 01/01/2010 format. also if the user selects current month then the record should be getdate() to go in database, else for any other month it should be 02/01/2010 (date = 01, first day of month). how do i do this in aspx.vb .net. i wrote a function to populate the dorpdownlist - Public Sub Load_dates(ByRef DDL As System.Web.UI.WebControls.DropDownList) Try Dim i As Integer Dim j As Integer For i = Now.Year To Now.Year For j = Now.Month To Now.Month + 11 DDL.Items.Add((j.ToString) + " " + (i.ToString)) Next Next Catch ex As Exception ReportError(ex) End Try End Sub this function only shows number like 01 2010 and 02 2010. how can i format this to show january 2010 and february 2010 and so on. please advice

    Read the article

  • Trying to link a domain to a IP

    - by user248959
    Hi, I have registered mydomain.com now i want to redirect to my IP hosting account. The DNS editor shows two fields: Name and Address. In Address i wrote the IP i want the domain redirects. And in Name I wrote mydomain.com. After submitting the form, the page shows this line: Name Type Record mydomain.mydomain.com. A 173.203.58.251 I expected it shows this: Name Type Record mydomain.com. A 173.203.58.251 Is that OK? or am i doing some wrong? Regards Javi

    Read the article

  • Pattern matching against Scala Map type

    - by Tom Morris
    Imagine I have a Map[String, String] in Scala. I want to match against the full set of key–value pairings in the map. Something like this ought to be possible val record = Map("amenity" -> "restaurant", "cuisine" -> "chinese", "name" -> "Golden Palace") record match { case Map("amenity" -> "restaurant", "cuisine" -> "chinese") => "a Chinese restaurant" case Map("amenity" -> "restaurant", "cuisine" -> "italian") => "an Italian restaurant" case Map("amenity" -> "restaurant") => "some other restaurant" case _ => "something else entirely" } The compiler complains thulsy: error: value Map is not a case class constructor, nor does it have an unapply/unapplySeq method What currently is the best way to pattern match for key–value combinations in a Map?

    Read the article

  • What's in-memory database technology that do realtime materialized view?

    - by KA100
    What I'm looking for is something like materialized views in front-end that shows my data in diffident ways without full recalculation. let's say I have stock watcher with many front-end views and dashborads some based on aggregation, order by or just filter with different criteria defined realtime by user. Now, I receive online record updates from some webservice and it's not like "data warehouse" every single record can be updated any time and it actually happens every second. Is there any technology can help me in such I create something like materialized view and it's update it without doing full recalculation every time data changed. Thank you.

    Read the article

  • Where to store users visited pages?

    - by kofto4ka
    Hi there. I have a project, where I have posts for example. The task is next: I must show to user his last posts visit. This is my solution: every time user visits new (for him) topic, I create a new record in table visits. Table visits has next structure: id, user_id, post_id, last_visit. Now my tables visits has ~14,000,000 records and its still growing every day.. May be my solution isnt optimal and exists another way how to store users visits? Its important to save every visit as standalone record, because I also have feature to select and use users visits. And I cant purge this table, because data could be needed later month, year. How I could optimize this situation?

    Read the article

  • The big last_insert_id() problem, again.

    - by wretrOvian
    Note - this follows my question here: http://stackoverflow.com/questions/2983685/jdbc-does-the-connection-break-if-i-lose-reference-to-the-connection-object Now i have a created a class so i can deal with JDBC easily for the rest of my code - public class Functions { private String DB_SERVER = ""; private String DB_NAME = "test"; private String DB_USERNAME = "root"; private String DB_PASSWORD = "password"; public Connection con; public PreparedStatement ps; public ResultSet rs; public ResultSetMetaData rsmd; public void connect() throws java.io.FileNotFoundException, java.io.IOException, SQLException, Exception { String[] dbParms = Parameters.load(); DB_SERVER = dbParms[0]; DB_NAME = dbParms[1]; DB_USERNAME = dbParms[2]; DB_PASSWORD = dbParms[3]; // Connect. Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://" + DB_SERVER + "/" + DB_NAME, DB_USERNAME, DB_PASSWORD); } public void disconnect() throws SQLException { // Close. con.close(); } } As seen Parameters.load() refreshes the connection parameters from a file every-time, so that any changes to the same may be applied on the next immediate connection. An example of this class in action - public static void add(String NAME) throws java.io.FileNotFoundException, java.io.IOException, SQLException, Exception { Functions dbf = new Functions(); dbf.connect(); String query = "INSERT INTO " + TABLE_NAME + "(" + "NAME" + ") VALUES(?)"; PreparedStatement ps = dbf.con.prepareStatement(query); ps.setString(1, NAME); ps.executeUpdate(); dbf.disconnect(); } Now here is the problem - for adding a record to the table above, the add() method will open a connection, add the record - and then call disconnect() . What if i want to get the ID of the inserted record after i call add() -like this : Department.add("new dept"); int ID = getlastID(); Isn't it possible that another add() was called between those two statements?

    Read the article

  • Physical storage of data in Access 2007

    - by ste
    I've been trying to estimate the size of an Access table with a certain number of records. It has 4 Longs (4 bytes each), and a Currency (8 bytes). In theory: 1 Record = 24 bytes, 500,000 = ~11.5MB However, the accdb file (even after compacting) increases by almost 30MB (~61 bytes per record). A few extra bytes for padding wouldn't be so bad, but 2.5X seems a bit excessive - even for Microsoft bloat. What's with the discrepancy? The four longs are compound keys, would that matter?

    Read the article

  • Model association changes in production environment, specifically converting a model to polymorphic?

    - by dustmoo
    Hi everyone, I was hoping I could get feedback on major changes to how a model works in an app that is in production already. In my case I have a model Record, that has_many PhoneNumbers. Currently it is a typical has_many belongs_to association with a record having many PhoneNumbers. Of course, I now have a feature of adding temporary, user generated records and these records will have PhoneNumbers too. I 'could' just add the user_record_id to the PhoneNumber model, but wouldn't it be better for this to be a polymorphic association? And if so, if you change how a model associates, how in the heck would I update the production database without breaking everything? .< Anyway, just looking for best practices in a situation like this. Thanks!

    Read the article

  • Outputting audio stream into microphone

    - by Brap
    Hey everyone. Is there a way of outputting audio from my program and redirecting that stream to the system's microphone input 'layer'? I understand this might require some low-level calls being 'Pinvoked', but are there any articles that might help me. For example, if I was to run the output audio stream of my application into Window's Sound Recorder program, it would think that the audio is coming from a microphone and thus record that. I don't want to record a stream, just output it to the device's micrphone input. Thanks for any ideas.

    Read the article

  • Problem with Nulls and an UPDATE statement

    - by Dave
    UPDATE TableA SET Value = a.Value * b.AnotherValue FROM TableA AS a INNER JOIN TableB AS b WHERE (Condition is true); Here is the problem. The Value field for TableA does not allow nulls. If the calculation of a.Value * b.AnotherValue yields a null, an error is thrown. Now the question. Is there any way to tell the UPDATE to ignore the SET phase when the result of the calculation is a null and delete the record rather than updating it. This UPDATE is intended to update hundreds of records at a time but will fail if a single null is encountered. Also, please note that using the ISNULL() function and setting the Value to zero is not acceptable. I would like the record to be dropped if a null is encountered. Many thanks in advance for any help rendered.

    Read the article

  • Locking a detail view if a user is editing the item...

    - by BenTheDesigner
    Hi All I am developing a user manager which must control access to the detail view of editable items. At present, when a user clicks 'edit', the application queries the link table to check if a user is currently editing that page, if not, it allows access to the page and then inserts a record into the link table preventing another user from editing the same page at the same time. My question is what would the best way to handle the removal of records if say a user exists the browser without saving etc, therefore no action to remove the record. I have a couple of ideas but would like other input before I decide. BenTheDesigner

    Read the article

  • How to find the real problem line in my code with Application Verifier ?

    - by Newbie
    I am now trying to use this Application Verifier debugging tool, but i am stuck, first of all: it breaks the program at a line that is simple variable set line (s = 1; for example) Secondly, now when i run this program under debugger, my program seems to have changed its behaviour: i am drawing image, and now one of the colors has changed o_O, all those parts of the image that i dont draw on, has changed the color to #CDCDCD when it should be #000000, and i already set the default color to zero, still it becomes to #CDCDCD. How do i make any sense to this? Here is the output AV gave me: VERIFIER STOP 00000002: pid 0x8C0: Access violation exception. 14873000 : Invalid address causing the exception 004E422C : Code address executing the invalid access 0012EB08 : Exception record 0012EB24 : Context record AVRF: Noncontinuable verifier stop 00000002 encountered. Terminating process ... The program '[2240] test.exe: Native' has exited with code -1073741823 (0xc0000001).

    Read the article

  • Save response from certain WEB resources while recording scenario

    - by jdevelop
    I need to create scenario for user interaction with single-page WEB application. The application does lots of AJAX calls in order to authenticate user and get user data. So I created simple scenario with HTTP Test Script Recorder and tried to record my script. Everything went well, however I noticed that whilst request data is recorder properly, the response data is not recorder at all. I tried to enable Add assertions and Regex matching - but that didn't work as well. Can you please advice how do I record response texts as well?

    Read the article

  • Some tables mixed together

    - by DJPython
    Hello. I have 2 different tables in my database. They have some variables common and some different. For example: Table1: ID Date Name Address Fax Table2: ID Date Name e-mail Telephone number I want to display data together sorted by date & ID but from both tables. For example, first displayed will be the newest record from first table, but the second one will be the record from another table posted right after first one. Hope everybody understand, sorry for my English. Cheers.

    Read the article

  • MySQL some columns Distinct

    - by Adam
    I have the following query that works well. SELECT DISTINCT city,region1,region2 from static_geo_world where country='AU' AND (city LIKE '%geel%' OR region1 LIKE '%geel%' OR region2 LIKE '%geel%' OR region3 LIKE '%geel%' OR zip LIKE 'geel%') ORDER BY city; I need to also extract a column named 'id' but this messes up the DISTINCT as each ID is different. How can I get the same UNIQUE set of records as above but also get the 'id' for each record? Note: sometimes I can return a few thousand records so a query for each record isn't possible. Any ideas would be very welcome...

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >