Search Results

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

Page 47/405 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • h2 in-memory tables, remote connection

    - by Carolyn
    I am having problems with creating an in memory table, using H2 database, and accessing it outside of the JVM it is created and running in. The documentation structures the url as "jdbc:h2:tcp:///mem:' I've tried many combinations, but simply cannot get the remote connection to work. Is this feature working, can anyone give me the details of how they used this.

    Read the article

  • Many to Many Association Tables - Is it customary to put additional columns in these tables?

    - by Randy Minder
    We've encountered the following situation in our database. We have table 'A' and table 'B' which have a M2M relationship. The association table is named 'AB' and contains a FK column to table 'A' and a FK column to table 'B'. Now we've identified a need to store additional data about this association. For example, a date when the association occurred, and who made the association etc. We've decided to put these additional columns in the 'AB' association table. However, something tells me this is frowned upon by database purists. On the other hand, it makes no sense to us to create yet an additional table to store this associated data. What's the prevailing thought on this?

    Read the article

  • Selecting from 2 tables in a single query

    - by duder
    I have a table that I'm querying for value 43 in the second field and I return the value of the third field SELECT t1_field3 FROM table1 WHERE t1_field2=43 this returns 19, 39,73 t1_id t1_field2 t1_field3 ----- --------- --------- 1 43 19//// 2 43 39//// 3 43 73//// 4 73 43 5 13 40 Then I separately query a second table for additional information SELECT * FROM table2 WHERE t2_id=t1_field3 t2_id t2_field2 t2_field3 ----- --------- --------- 19 value19.2 value19.3 39 value39.2 value39.3 73 value73.2 value73.3 Is there a way I could combine both table1 and table2 in the same query?

    Read the article

  • has_many :through when join table doesn't contain FK to both tables

    - by seth.vargo
    I have a structure that isn't really a has_many :through example, but I'd like it to behave like one: # user.rb belongs_to :blog has_many :posts # post.rb belongs_to :user # blog.rb has_many :users has_many :posts, :through => :users # this obviously doesn't work becase # both FKs aren't in the blogs table I want to get ALL posts for a blog in an array. I'm aware that I can do this with Ruby using each or getting fancy with collect, but I'd like to let SQL do the work. Can someone explain how I can set up my models in a way that lets me call @blog.posts using SQL, not Ruby? Edit: I know in SQL I can write something like: SELECT * FROM posts WHERE posts.user_id IN ( SELECT users.id FROM users WHERE users.blog_id = 7 ) which obviously shows two queries are needed. I don't think this is possible with a join, but I'm not totally sure. It's obvious that a subquery is needed, but how do I get rails to build that subquery with ARel instead of having to return and use Ruby to loop and collect and such?

    Read the article

  • Rails running multiple delayed_job - lock tables

    - by pepernik
    Hey. I use delayed_job for background processing. I have 8 CPU server, MySQL and I start 7 delayed_job processes RAILS_ENV=production script/delayed_job -n 7 start Q1: I'm wondering is it possible that 2 or more delayed_job processes start processing the same process (the same record-row in the database delayed_jobs). I checked the code of the delayed_job plugin but can not find the lock directive in a way it should be. I think each process should lock the database table before executing an UPDATE on lock_by column. They lock the record simply by updating the locked_by field (UPDATE delayed_jobs SET locked_by...). Is that really enough? No locking needed? Why? I know that UPDATE has higher priority than SELECT but I think this does not have the effect in this case. My understanding of the multy-threaded situation is: Process1: Get waiting job X. [OK] Process2: Get waiting jobs X. [OK] Process1: Update locked_by field. [OK] Process2: Update locked_by field. [OK] Process1: Get waiting job X. [Already processed] Process2: Get waiting jobs X. [Already processed] I think in some cases more jobs can get the same information and can start processing the same process. Q2: Is 7 delayed_jobs a good number for 8CPU server? Why yes/not. Thx 10x!

    Read the article

  • Localized tables and Entity Framework

    - by Pyttroll
    Hi all, I have a scenario where I need to localized values of objects in my database. Let's say you have an application that can create animals, if the user is english the value of the "Name" property of an animal would be entered as "Cat" in the UI whereas it would be entered as "Chat" in french. The animal culture table would contain 2 records pointing to the same animal in the parent table. When reading values back, if the value of "Name" does not exist in the user culture the default value (value the object was originally created with) would be used. The following diagrams demonstrate how the data is stored in SQL: I'm trying to map this schema to an object model using the Entity Framework, I'm a bit confused as to what the best way to approach the problem. Is EF appropriate for this? Should I used EF4? This EF model will be used by .NET RIA Services. Thanks, Pierre-Yves Troel Ayuda Media Systems http://www.ayudasystems.com

    Read the article

  • SQLAlchemy: select over multiple tables

    - by ahojnnes
    Hi, I wanted to optimize my database query: link_list = select( columns=[link_table.c.rating, link_table.c.url, link_table.c.donations_in], whereclause=and_( not_(link_table.c.id.in_( select( columns=[request_table.c.recipient], whereclause=request_table.c.donator==donator.id ).as_scalar() )), link_table.c.id!=donator.id, ), limit=20, ).execute().fetchall() and tried to merge those two selects in one query: link_list = select( columns=[link_table.c.rating, link_table.c.url, link_table.c.donations_in], whereclause=and_( link_table.c.active==True, link_table.c.id!=donator.id, request_table.c.donator==donator.id, link_table.c.id!=request_table.c.recipient, ), limit=20, order_by=[link_table.c.rating.desc()] ).execute().fetchall() the database-schema looks like: link_table = Table('links', metadata, Column('id', Integer, primary_key=True, autoincrement=True), Column('url', Unicode(250), index=True, unique=True), Column('registration_date', DateTime), Column('donations_in', Integer), Column('active', Boolean), ) request_table = Table('requests', metadata, Column('id', Integer, primary_key=True, autoincrement=True), Column('recipient', Integer, ForeignKey('links.id')), Column('donator', Integer, ForeignKey('links.id')), Column('date', DateTime), ) There are several links (donator) in request_table pointing to one link in the link_table. I want to have links from link_table, which are not yet "requested". But this does not work. Is it actually possible, what I'm trying to do? If so, how would you do that? Thank you very much in advance!

    Read the article

  • Updating multiple tables with LinqToSql in one unit of work

    - by zsharp
    Table 1: int ID-a(pk) Table 2: int ID-a(pk), int ID-b(pk) Table 3: int ID-b(pk), string C I have the data to insert into Table 1. But I do not have the ID-a, which is autogenerated. I have many string C to insert in Table 3. I am trying to insert row into Table 1, get the ID-a to insert in Table 2 along with the ID-b that is auto-Generated in Table 3 when I submit each string C, all in one submission to db. Right now I am calling dc.SubmitChanges twice in same call. Is it efficient to have to submit changes twice on same DataContext or can this be combined further?

    Read the article

  • mysql - joining three tables with HAVING

    - by Qiao
    I have table: id name type where "type" is 1 or 2 I need to join this table with two other. Rows with "type = 1" should be joined with first table, and =2 with second. Something like SELECT * FROM tbl INNER JOIN tbl_1 ON tbl.name = tbl_1.name HAVING tbl.type = 1 INNER JOIN tbl_2 ON tbl.name = tbl_2.name HAVING tbl.type = 2 But it does not working. How it can be implemented?

    Read the article

  • Single HTML Table from multiple MySQL tables

    - by David Chouinard
    Hi! I've been struggling for a while with this one; I'll try to explain it here as simply as possible. Consider this MySQL table: +----------+-----------+---------+--------+ |status_id |session_id |pilot_id |present | +----------+-----------+---------+--------+ |1 |61 |901 |1 | |2 |63 |901 |1 | |3 |62 |901 |0 | |4 |62 |902 |1 | |5 |63 |903 |1 | +----------+-----------+---------+--------+ Both session_id and pilot_id are foreign keys making reference to a primary key in another table. The same pilot_id can be associated with different session_id, but every pilot_id-session_id combination is unique. I need to make an HTML table (in PHP) that would display the data like this: +----------+---------+---------+---------+ | |61 |62 |63 | +----------+---------+---------+---------+ |901 |X | |X | |902 | |X | | |903 | | |X | +----------+---------+---------+---------+ Hence, rows are pilot_id and columns are session_id. When a pilot_id-session_id combination has a present value of 1, the corresponding cell should be checked. (ie. when the row-combination is zero or the combination does not exist in the MySQL table, nothing should appear in the HTML table) Phew. Any ideas? Thanks!

    Read the article

  • Create fulltext index on a VIEW

    - by kylex
    Is it possible to create a full text index on a VIEW? If so, given two columns column1 and column2 on a VIEW, what is the SQL to get this done? The reason I'd like to do this is I have two very large tables, where I need to do a FULLTEXT search of a single column on each table and combine the results. The results need to be ordered as a single unit. Suggestions? EDIT: This was my attempt at creating a UNION and ordering by each statements scoring. (SELECT a_name AS name, MATCH(a_name) AGAINST('$keyword') as ascore FROM a WHERE MATCH a_name AGAINST('$keyword')) UNION (SELECT s_name AS name,MATCH(s_name) AGAINST('$keyword') as sscore FROM s WHERE MATCH s_name AGAINST('$keyword')) ORDER BY (ascore + sscore) ASC sscore was not recognized.

    Read the article

  • How to output JOINed tables?

    - by ilhan
    $id=(int)$_GET["id"]; $result = mysql_query("SELECT questionstable.*, categorytable.name FROM questionstable INNER JOIN categorytable ON categorytable.id = questionstable.category WHERE id=$id"); $row = mysql_fetch_assoc($result); Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Program Files\EasyPHP-5.3.4.0\www\scsoru.php on line 33

    Read the article

  • problem in fetching data from several tables in one query

    - by Mac Taylor
    hey guys in an attempt to union my querries into one query to database , now im in need of geting username of first poster and last poster of a topic in my forums here is my code to do as i told :: $result = $db->sql_query("SELECT t.*,p.*,u.* SUM(t.topic_approved='1') AS Amount_Of_Topics, SUM(p.post_approved ='1') AS Amount_Of_Posts FROM bb3topics t, bb3posts p, bb3users u GROUP BY t.topic_last_post_id ORDER BY t.topic_last_post_id DESC LIMIT 10 " ); while( $row = $db->sql_fetchrow($result) ) { $Amount_Of_Topics = $row['Amount_Of_Topics']; $Amount_Of_Posts = $row['Amount_Of_Posts']; $Amount_Of_Topic_Replies = $Amount_Of_Topic_Replies + $row['topic_replies']; $Amount_Of_Topic_Views = $Amount_Of_Topic_Views + $row['topic_views']; $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; $topic_last_post_id = $row['topic_last_post_id']; $topic_title = $row['topic_title']; $topic_poster = $row['topic_poster']; $topic_views = $row['topic_views']; $topic_replies = $row['topic_replies']; $topic_moved_id = $row['topic_moved_id']; $topic_time = $row['topic_time']; $result2 = $db->sql_query( "SELECT topic_id, poster_id, post_time FROM bb3posts where post_id = '$topic_last_post_id'" ); list( $topic_id, $poster_id, $post_time ) = $db->sql_fetchrow( $result2 ); $result3 = $db->sql_query( "SELECT username, user_id FROM bb3users where user_id='$poster_id'" ); list( $uname, $uid ) = $db->sql_fetchrow( $result3 ); $LastPoster = "$uname"; $result4 = $db->sql_query( "SELECT username, user_id FROM bb3users where user_id='$topic_poster'" ); list( $uname, $uid ) = $db->sql_fetchrow( $result4 ); $OrigPoster = "$uname"; now i need to query all this together not in separated ones i tried using left join but didn't worked what mysql conjunction should i use ?!

    Read the article

  • CSS Make one row the width of another

    - by gav
    I'm sure this is a fairly common problem but I'm new to CSS so I'm not sure how it's done. I tried searching for the issue but sometimes it's tricky to get the right keywords. I have a table the width of which I want to be constrained by a specific row. My table css is as follows; table { border: 1px solid #ccc; width: auto; margin-left: auto; margin-right: auto; } I have one row which contains cells for which I want the width to autofit and two rows of prose which currently force the table to take 100% width. How do I constrain the latter to have at most the autofit width of the first row? If tables aren't the way to go and this should be pure css and divs, how do you get one class to adopt the fixed but unknown width of another? Thanks, Gav

    Read the article

  • Arrays in database tables and normalization

    - by Ivan Petrov
    Hi! Is it smart to keep arrays in table columns? More precisely I am thinking of the following schema which to my understanding violates normalization: create table Permissions( GroupID int not null default(-1), CategoryID int not null default(-1), Permissions varchar(max) not null default(''), constraint PK_GroupCategory primary key clustered(GroupID,CategoryID) ); and this: create table Permissions( GroupID int not null default(-1), CategoryID int not null default(-1), PermissionID int not null default(-1), constraint PK_GroupCategory primary key clustered(GroupID,CategoryID) ); UPD: Forgot to mention, in the scope of this concrete question we will consider that the "fetch rows that have permission X" won't be performed, instead all the lookups will be made by GroupID and CategoryID only Thoughts? Thanks in advance!

    Read the article

  • SQL Server Constraints Across Tables

    - by chama
    I have a SQL Server database with an Apartment table (which has columns FloorNum and BuildingID) and an ApartmentBuilding table (with column NumFloors). Is there any way to set up a constraint (using the SQL Server UI) to check that Apartment.FloorNum is greater than ApartmentBuilding.NumFloors? I tried this: FloorNum > ApartmentBuilding.NumFloors but now I realize that I somehow have to join the columns on the BuildingID, but I have no idea how to do that within a constraint. Thanks for your help!

    Read the article

  • Querying Two Tables At Once

    - by John
    Hello, I am trying to do what I believe is called a join query. First, in a MySQL table called "login," I want to look up what "loginid" is in the record where "username" equals $profile. (This will be just one record / row in the MySQL table). Then, I want to take that "loginid" and look up all rows / records in a different MySQL table called "submission," and pull data that have that "loginid." This could possibly be more than one record / row. How do I do this? The code below doesn't seem to work. Thanks in advance, John $profile = mysql_real_escape_string($_GET['profile']); $sqlStr = "SELECT l.username, l.loginid, s.loginid, s.submissionid, s.title, s.url, s.datesubmitted, s.displayurl FROM submission AS s, login AS l WHERE l.username = '$profile', s.loginid = l.loginid ORDER BY s.datesubmitted DESC";

    Read the article

  • Oracle DBMS_PROFILER only shows Anonymous in the results tables

    - by Greg Reynolds
    I am new to DBMS_PROFILER. All the examples I have seen use a simple top-level procedure to demonstrate the use of the profiler, and from there get all the line numbers etc. I deploy all code in packages, and I am having great difficulty getting my profile session to populate the plsql_profiler_units with useful data. Most of my runs look like this: RUNID RUN_COMMENT UNIT_OWNER UNIT_NAME SECS PERCEN ----- ----------- ----------- -------------- ------- ------ 5 Test <anonymous> <anonymous> .00 2.1 Profiler 5 Test <anonymous> <anonymous> .00 2.1 Profiler 5 Test <anonymous> <anonymous> .00 2.1 Profiler I have just embedded the calls to the dbms_profiler.start_profiler, flush_data and stop_profiler as per all the examples. The main difference is that my code is in a package, and calls in to other package. Do you have to profile every single stored procedure in your call stack? If so that makes this tool a little useless! I have checked http://www.dba-oracle.com/t_plsql_dbms_profiler.htm for hints, among other similar sites.

    Read the article

  • MySQL Ratings From Two Tables

    - by DirtyBirdNJ
    I am using MySQL and PHP to build a data layer for a flash game. Retrieving lists of levels is pretty easy, but I've hit a roadblock in trying to fetch the level's average rating along with it's pointer information. Here is an example data set: levels Table: level_id | level_name 1 | Some Level 2 | Second Level 3 | Third Level ratings Table: rating_id | level_id | rating_value 1 | 1 | 3 2 | 1 | 4 3 | 1 | 1 4 | 2 | 3 5 | 2 | 4 6 | 2 | 1 7 | 3 | 3 8 | 3 | 4 9 | 3 | 1 I know this requires a join, but I cannot figure out how to get the average rating value based on the level_id when I request a list of levels. This is what I'm trying to do: SELECT levels.level_id, AVG(ratings.level_rating WHERE levels.level_id = ratings.level_id) FROM levels I know my SQL is flawed there, but I can't figure out how to get this concept across. The only thing I can get to work is returning a single average from the entire ratings table, which is not very useful. Ideal Output from the above conceptually valid but syntactically awry query would be: level_id | level_rating 1| 3.34 2| 1.00 3| 4.54 My main issue is I can't figure out how to use the level_id of each response row before the query has been returned. It's like I want to use a placeholder... or an alias... I really don't know and it's very frustrating. The solution I have in place now is an EPIC band-aid and will only cause me problems long term... please help!

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >