Search Results

Search found 10101 results on 405 pages for 'temporary tables'.

Page 133/405 | < Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >

  • How to properly design a simple favorites and blocked table?

    - by Nils Riedemann
    Hey, i am currently writing a webapp in rails where users can mark items as favorites and also block them. I came up two ways and wondered which one is more common/better way. 1. Separate join tables Would it be wise to have 2 tables for this? Like: users_favorites - user_id - item_id users_blocked - user_id - item_id 2. single table users_marks (or so) - users_id - item_id - type (["fav", "blk"]) Both ways seem to have advantages. Which one would you use and why?

    Read the article

  • Disregard a particular TD element

    - by RussellDias
    Below I have the code that allows me to edit a table row inline. However it edits ALL of the TDs within that row. My problem, along with the code, are stated below. Any help is appreciated. <tbody> <tr> <th scope="row">Test</th> <td class="amount">$124</td> <td class="amount" id="" >$154</td> <td class="diff">- 754</td> </tr> </tbody> The above table is just a sample. What I have been trying to accomplish is, to simply edit the TDs within that particular row, but I need it to disregard the diff TD. I'm fairly new to jQuery and have got the following code via the help of a jQuery book. $(document).ready(function() { TABLE.formwork('#current-expenses'); }); var TABLE = {}; TABLE.formwork = function(table){ var $tables = $(table); $tables.each(function () { var _table = $(this); _table.find('thead tr').append($('<th class="edit">&nbsp;</th>')); _table.find('tbody tr').append($('<td class="edit"><input type="button" value="Edit"/></td>')) }); $tables.find('.edit :button').live('click', function(e) { TABLE.editable(this); e.preventDefault(); }); } TABLE.editable = function(button) { var $button = $(button); var $row = $button.parents('tbody tr'); var $cells = $row.children('td').not('.edit'); if($row.data('flag')) { // in edit mode, move back to table // cell methods $cells.each(function () { var _cell = $(this); _cell.html(_cell.find('input').val()); }) $row.data('flag',false); $button.val('Edit'); } else { // in table mode, move to edit mode // cell methods $cells.each(function() { var _cell = $(this); _cell.data('text', _cell.html()).html(''); if($('td.diff')){ var $input = $('<input type="text" />') .val(_cell.data('text')) .width(_cell.width() - 16); _cell.append($input); } }) $row.data('flag', true); $button.val('Save'); } } I have attempted to alter the code so that it would disregard the diff class TD, but have had no luck so far.

    Read the article

  • Purely functional equivalent of weakhashmap?

    - by Jon Harrop
    Weak hash tables like Java's weak hash map use weak references to track the collection of unreachable keys by the garbage collector and remove bindings with that key from the collection. Weak hash tables are typically used to implement indirections from one vertex or edge in a graph to another because they allow the garbage collector to collect unreachable portions of the graph. Is there a purely functional equivalent of this data structure? If not, how might one be created? This seems like an interesting challenge. The internal implementation cannot be pure because it must collect (i.e. mutate) the data structure in order to remove unreachable parts but I believe it could present a pure interface to the user, who could never observe the impurities because they only affect portions of the data structure that the user can, by definition, no longer reach.

    Read the article

  • How does linq decide between inner & outer joins

    - by user287795
    Hi Usually linq is using an left outer join for its queries but on some cases it decides to use inner join instead. I have a situation where that decision results in wrong results since the second table doesn't always have suitable records and that removes the records from the first table. I'm using a linqdatasource over a dbml where the relevant tables are identical but one holds historical records removed from the first. both have the same primary key. and I'm using a dataloadoption to load both tables at once with out round trips. Would you explain why linq decided to use an inner join here? Thanks

    Read the article

  • Define classes for a datatable structure - ORM

    - by user424493
    I have existing tables - I have following datatables : ActivityTable(Key ActivityId) - which lists the identifier for various activity ProcessTable (identified by ProcessId) - which lists down which activites(ActivityId) are to be carried out along with their order(StepNum). Some of the activities are marked constant with in a process, that is they will have same data, ir-respective of there run environment. RunTable(Key RunConfigurationId) - that identifies the project name and Process Id Then data for each activity is stored is stored in their individual tables Activity_A, Activity_B,Activity_C so on it uses a combination of RunConfigurationId,ProcessId and stepNum. For the activities which are constant we use a RunConfigurationId= -100. Can anybody help me out how I can map something like this in classes using inheritence regards

    Read the article

  • JPA Bidirectional OneToMany and ManyToOne?

    - by PhoenixJon
    I'm using Oracle JDeveloper 11g Release 2. I created two tables A and B using SQL developer. Table A has a FK to table B. Using the Entities from Tables function, I created two JPA files from it. A has @ManyToOne annotation on FK. And also B has @OneToMany annotation to A. I don't want this. Can I remove this @OneToMany annotation automatically? public class A implements Serializable { ... @ManyToOne @JoinColumn(name = "FIELD_B") private B b; ... } public class B implements Serializable { ... @OneToMany(mappedBy = "B") private List<A> assetList; ... } I don't need @OneToMany mapping.

    Read the article

  • SQL Server 2008 - Get Latest Record from Joined Table

    - by user336786
    Hello, I have a SQL Server 2008 database. This database has two tables called Customer and Order. These tables are defined as follows: Customer -------- ID, First Name, Last Name Order ----- ID, CustomerID, Date, Description I am trying to write a query that returns all of the customers in my database. If the user has placed at least one order, I want to return the information associated with the most recent order placed. Currently, I have the following: SELECT * FROM Customer c LEFT OUTER JOIN Order o ON c.[ID]=o.[CustomerID] As you can imagine, this will return all of the orders associated with a customer. In reality though, I only want the most recent one. How do I do this in SQL? Thank you!

    Read the article

  • The best practice to setup hierarchy data

    - by eski
    I'm trying to figure out the best practice to setup hierarchy data that i take from a database into some contoller that would show the hierachy. Basicly this would look like a normal tree but when you press the items that are under "chapters" you get a link to another page. I have these tables and this is the way they are connected Period Courses Subjects Chapters I select Period from a DropDownBox and then i want all the courses in that period to line up. Under each course would be the subject and under them are the chapers, typical hierarchy. The tables are linked together with refrences to each other in linear way. I have tried to use treeview to show this, but dont understand how to do it. I though i could use <ul><il> tags and do it at runtime. Reapeter or datalist, possible ? Is it better to do this with databinding in XAML or in code ?

    Read the article

  • Using Multiple Databases

    - by sergiuoala
    A company is hired by another company for helping in a certain field. So I created the following tables: Companies: id, company name, company address Administrators: (in relation with companies) id, company_id, username, email, password, fullname Then, each company has some workers in it, I store data about workers. Hence, workers has a profession, Agreement Type signed and some other common things. Now, the parent tables and data in it for workers (Agreement Types, Professions, Other Common Things) are going to be the same for each company. Should I create 1 new database for each company? Or store All data into the same database? Thanks.

    Read the article

  • SQLiteOpenHelper problem

    - by Harsha M V
    I have created SQLiteOpenHelper class to help me open write the database. but i am not able to invoke it from the main.java activity I have created an Class which extends the Database Helper which is stored at /Messaging/src/com/v3/messaging/DatabaseHelper.java Code: http://pastebin.com/Z5qp32xu now i have this class called Main.java which will be the first activity on the launch of the application. But how can i make the DatabaseHelper.java run just to create the database but still be at the Main.java file. The database should be created with the tables only when the db or the tables dont exist. Main.java code: http://pastebin.com/LVFVuhA0 Now when i run the program. the database is not being created :( I am trying to learn Android. So please excuse me if i forgot to tell something.

    Read the article

  • How to join this table?

    - by pamella
    ads table img90.imageshack.us/img90/6295/adsvo.png phones table img194.imageshack.us/img194/3713/phones.png cars table img35.imageshack.us/img35/1035/carsm.png i have 3 tables ads,cars and phones. i want to join tables is based on category in ads table. and i tried this query but no luck,any helps? SELECT * FROM `ads` JOIN `ads.category` ON `ads.id` = `ads.category.id` ** i cant add comment any of your post,but i want it to be automatic based on category in ads table. for example :- if in table have phones category,i will automatic join phones table then SELECT * FROM `ads` JOIN `phone` ON `ads.id` = `phone.id` if in table have cars category,i will automatic join cars table SELECT * FROM `ads` JOIN `cars` ON `ads.id` = `cars.id`

    Read the article

  • Embedded Java Databases for Large Data Sets

    - by ExAmerican
    I would like to port a PHP/MySQL-based client/server application to be a standalone desktop application written in Java. The database has grown to be fairly large, with several tables with hundreds of thousands of rows. I expect these could grow to over a million entries for certain tables. What embedded database would best handle this? HSQLDB and Sqlite seem to be the obvious choices, though I'm guessing there are others out there as well. My main priorities are the ability to perform queries on large amounts of data efficiently (this thread seems to confirm Sqlite can handle this) and the ease with which I can import old data from MySQL (I remember HSQLDB being kind of a pain for that). Note: I am aware that similar questions comparing embedded databases have been posted before (for example here and here) but as my priorities differ somewhat from most applications considering the large data migration I thought it justified a new question.

    Read the article

  • How do I split the output from mysqldump into smaller files?

    - by lindelof
    I need to move entire tables from one MySQL database to another. I don't have full access to the second one, only phpMyAdmin access. I can only upload (compressed) sql files smaller than 2MB. But the compressed output from a mysqldump of the first database's tables is larger than 10MB. Is there a way to split the output from mysqldump into smaller files? I cannot use split(1) since I cannot cat(1) the files back on the remote server. Or is there another solution I have missed? Edit The --extended-insert=FALSE option to mysqldump suggested by the first poster yields a .sql file that can then be split into importable files, provided that split(1) is called with a suitable --lines option. By trial and error I found that bzip2 compresses the .sql files by a factor of 20, so I needed to figure out how many lines of sql code correspond roughly to 40MB.

    Read the article

  • MySQL: Query to obtain recipes using all given ingredients.

    - by John_A
    hi I have the following simplified tables: CREATE TABLE recipe(id int, name varchar(25)); CREATE TABLE ingredient(name varchar(25)); CREATE TABLE uses_ingredient(recipe_id int, name varchar(25)); I want to make a query that returns all id's of recipes that contain both Chicken and Cream. I have tried SELECT recipe_id FROM uses_ingredient INNER JOIN (SELECT * FROM ingredient WHERE name="Chicken" OR name="Cream") USING (name) GROUP BY recipe_id HAVING COUNT(recipe_id) >= (SELECT COUNT(*) FROM theme); which gives me :"ERROR 1248 (42000): Every derived table must have its own alias" and is probably wrong too. Next I tried SELECT recipe_id FROM (SELECT * FROM ingredient WHERE name="Chicken" OR name="Cream") AS t INNER JOIN uses_ingredient USING (name) GROUP BY recipe_id HAVING COUNT(recipe_id)>= (SELECT COUNT(*) FROM t); which gives "ERROR 1146 (42S02): Table 'recipedb.t' doesn't exist" I want to avoid creating temporary tables including using ENGINE=MEMORY.

    Read the article

  • get data from database by manually giving the server name

    - by syedsaleemss
    Im using c# .net windows application form. I have created many databases with many tables in each. I have a datagrid view and a display button. when i click on this button, the system must prompt me to enter the server name and after typing the server name, it should display all the databases related to that server in some combo box. and again if i select a database it should show all the tables present in that database into a combobox. and if i select a table, it should prompt an option to select only required columns into the datagridview. How can i do this?

    Read the article

  • INSERT INTO othertbl SELECT * tbl

    - by Harry
    Current situation: INSERT INTO othertbl SELECT * FROM tbl WHERE id = '1' So i want to copy a record from tbl to othertbl. Both tables have an autoincremented unique index. Now the new record should have a new index, rather then the value of the index of the originating record else copying results in a index not unique error. A solution would be to not use the * but since these tables have quite some columns i really think it's getting ugly. So,.. is there a better way to copy a record which results in a new record in othertbl which has a new autoincremented index without having to write out all columns in the query and using a NULL value for the index. -hope it makes sense....-

    Read the article

  • mysql select multiple rows in join

    - by julio
    Hi-- I have a simple mySQL problem-- I have two tables, one is a user's table, and one is a photos table (each user can upload multiple photos). I'd like to write a query to join these tables, so I can pull all photos associated with a user (up to a certain limit). However, when I do something obvious like this: SELECT *.a, *.b FROM user_table a JOIN photos_table b ON a.id = b.userid it returns a.id, a.name, a.email, a.address, b.id, b.userid, b.photo_title, b.location but it only returns a single photo. Is there a way to return something like: a.id, a.name, a.email, a.address, b.id, b.userid, b.photo_title, b.location, b.id2, b.photo_title2, b.location2 etc. . . for a given LIMIT of photos? Thanks for any ideas.

    Read the article

  • MySQL AND alternative for eatch table in a join

    - by Scott
    I have a simple join in a query however I need to have a condition on both of the tables "confirmed='yes'" but if one of the tables doesn't have any that match the query returns with no rows. Database: .----------parties----------. | id - party_id - confirmed | |---------------------------| | 1 1 yes | | 1 2 no | | 1 3 no | +---------------------------+ .-----------events----------. | id - event_id - confirmed | |---------------------------| | 1 1 no | +---------------------------+ Query: SELECT p.party_id, e.event_id FROM parties p LEFT JOIN events e ON p.id=e.id WHERE p.id = '1' AND p.party_id IN (1,2,3) AND e.event_id IN (1) AND p.confirmed='yes' AND e.confirmed='yes' It returns nothing but I want it to return party_id 1 with a empty event_id. I hope this make sense and I not missing anything, Thanks for your help!

    Read the article

  • SQL query for fetching friend list

    - by Bhavyanshu
    I need help with SQL query. I have two tables. One is users and other one is userfriends users table: aid email firstname 1 [email protected] example 2 [email protected] example2 3 [email protected] example3 4 [email protected] example4 userfriends tables: reqid email friendemail status 1 [email protected] [email protected] 1 (example1 is frnds with example2) 2 [email protected] [email protected] 2 (example2 request pending) 3 [email protected] [email protected] 1 (example1 is frnds with example3) 4 [email protected] [email protected] 1 (example1 is frnds with example4) So when status is 2 the add request is pending and at status 1 they are friends. What i want is that i want to retrieve the complete friendlist for user example1. I want to pull out names from users table for corresponding output from previous query to display as friendlist.

    Read the article

  • Improve SQL query performance

    - by Anax
    I have three tables where I store actual person data (person), teams (team) and entries (athlete). The schema of the three tables is: In each team there might be two or more athletes. I'm trying to create a query to produce the most frequent pairs, meaning people who play in teams of two. I came up with the following query: SELECT p1.surname, p1.name, p2.surname, p2.name, COUNT(*) AS freq FROM person p1, athlete a1, person p2, athlete a2 WHERE p1.id = a1.person_id AND p2.id = a2.person_id AND a1.team_id = a2.team_id AND a1.team_id IN ( SELECT id FROM team, athlete WHERE team.id = athlete.team_id GROUP BY team.id HAVING COUNT(*) = 2 ) GROUP BY p1.id ORDER BY freq DESC Obviously this is a resource consuming query. Is there a way to improve it?

    Read the article

  • :from parameter in active record find not well designed?

    - by potlee
    i got this error: SQLite3::SQLException: no such column: apis.name: SELECT * FROM examples WHERE ("apis"."name" = 'deep') my code Api.find :all, :from => params[:table_name], :conditions => {:name => 'deep' } I need to make a back end rails application which will be used by a silverlight application. one of the requirements is to fetch simple data from the database. i need to be able to query different tables with the same code.(my app has 2000 tables!) i think it does not make sense for rails to put in "apis" in the WHERE clause. is there any speciic reason for this?

    Read the article

  • using different string files in android

    - by boreas
    I'm porting my iPhone app to android and I'm having a problem with the string files now. The app is a translation tool and users can switch the languages, so all the localized strings are in both languages and they are independent from what locale the OS is running. For iOS version I have different files like de.strings, en.strings and fr.strings and so on. For every target with specified language pair I read the strings from the string tables, e.g. for de-fr I will include de.strings and fr.strings in project and set the name of the string tables in the info-list file and read strings from them. In the end I have one project containing different targets (with different info-list files) and all are well configured. I'm intending to do the same on android platform, but Is only one strings.xml allowed per project? How do I set different build target? How do I specify per target which strings.xml it should read?

    Read the article

  • Oracle checking existence before deletion in a trigger

    I have analyzed a hibernate generated oracle database and discovered that a delete of a row from a single table will spawn the firing of 1200+ triggers in order to delete the related rows in child tables. The triggers are all auto-generated the same - an automatic delete of a child row without checking for existence first. As it is impossible to predict which child tables will actually have related rows, I think a viable solution to preventing the firing of the cascaded delete down a deeply branched completely empty limb, would be to check for the existence of a related row before attempting to delete. In other dbms', I could simply state " if exists....." before deleting. Is there a comparable way to do this in oracle?

    Read the article

< Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >