Search Results

Search found 6276 results on 252 pages for 'join'.

Page 23/252 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Problem with between join for sqlalchemy orm relation.

    - by Gary van der Merwe
    I'm trying to create a relation that has a between join. Here is a shortish example of what I'm trying to do: #!/usr/bin/env python import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.engine.base import Engine from sqlalchemy.ext.declarative import declarative_base metadata = sa.MetaData() Base = declarative_base(metadata=metadata) engine = sa.create_engine('sqlite:///:memory:') class Network(Base): __tablename__ = "network" id = sa.Column(sa.Integer, primary_key=True) ip_net_addr_db = sa.Column('ip_net_addr', sa.Integer, index=True) ip_broadcast_addr_db = sa.Column('ip_broadcast_addr', sa.Integer, index=True) # This can be determined from the net address and the net mask, but we store # it in the db so that we can join with the address table. ip_net_mask_len = sa.Column(sa.SmallInteger) class Address(Base): __tablename__ = "address" ip_addr_db = sa.Column('ip_addr', sa.Integer, primary_key=True, index=True, unique=True) Network.addresses = orm.relation(Address, primaryjoin=Address.ip_addr_db.between( Network.ip_net_addr_db, Network.ip_broadcast_addr_db), foreign_keys=[Address.ip_addr_db]) metadata.create_all(engine) Session = orm.sessionmaker(bind=engine) Network() I you run this, you get this error: ArgumentError: Could not determine relation direction for primaryjoin condition 'address.ip_addr BETWEEN network.ip_net_addr AND network.ip_broadcast_addr', on relation Network.addresses. Do the columns in 'foreign_keys' represent only the 'foreign' columns in this join condition ? The answer to that question is Yes, but I cant figure out how to tell it that

    Read the article

  • SQL Server join and wildcards

    - by Ernst
    I want to get the results of a left join between two tables, with both having a column of the same name, the column on which I join. The following query is seen as valid by the import/export wizard in SQL Server, but it always gives an error. I have some more conditions, so the size wouldn't be too much. We're using SQL Server 2000 iirc and since we're using an externally developed program to interact with the database (except for some information we can't retrieve that way), we can not simply change the column name. SELECT table1.*, table2.* FROM table1 LEFT JOIN table2 ON table1.samename = table2.samename At least, I think the column name is the problem, or am I doing something else wrong?

    Read the article

  • Rails 3 nested forms with has_many :through, entry in join table dosen't get deleted after update

    - by Hadi S.
    Hi, i have a 'User' model which has a has_many relationship to a 'Number' model through a join table 'user_number' model. I use accepts_nested_attributes_for :numbers, :allow_destroy = true in the 'User' model. Everything works fine except that whenever i delete a number from a user in the edit form, the associated number is deleted correctly in the 'number' table, but not the entry in the 'user_number' join table. In the update controller action i only use this: ... if @user.update_attributes(params[:user]) ... How can i force rails to also delete the associated entry in the join table?

    Read the article

  • Linq to Entities - left Outer Join

    - by user255234
    Could you please help me to figure this one out? I need to replace a join with OSLP table with OUTER join. Seems a bit tricky for someone who is not an expert in Linq to entities. How would I do that? var surgeonList = ( from item in context.T1_STM_Surgeon .Include("T1_STM_SurgeonTitle") .Include("OTER") where item.ID == surgeonId join reptable in context.OSLP on item.Rep equals reptable.SlpCode select new { ID = item.ID, First = item.First, Last = item.Last, Rep = reptable.SlpName, Reg = item.OTER.descript, PrimClinic = item.T1_STM_ClinicalCenter.Name, Titles = item.T1_STM_SurgeonTitle, Phone = item.Phone, Email = item.Email, Address1 = item.Address1, Address2 = item.Address2, City = item.City, State = item.State, Zip = item.Zip, Comments = item.Comments, Active = item.Active, DateEntered = item.DateEntered }).ToList(); Thanks in advance!!

    Read the article

  • how do I join and include the association

    - by Mark
    Hi All, How do I use both include and join in a named scope? Post is polymorphic class Post has_many :approved_comments, :class_name => 'Comment' end class Comment belongs_to :post end Comment.find(:all, :joins => :post, :conditions => ["post.approved = ? ", true], :include => :post) This does not work as joins does an inner join, and include does a left out join. The database throws an error as both joins can't be there in same query.

    Read the article

  • How to have multiple tables with multiple joins

    - by williamsdb
    I have three tables that I need to join together and get a combination of results. I have tried using left/right joins but they don't give the desired results. For example: Table 1 - STAFF id name 1 John 2 Fred Table 2 - STAFFMOBILERIGHTS id staffid mobilerightsid rights --this table is empty-- Table 3 - MOBILERIGHTS id rightname 1 Login 2 View and what I need is this as the result... id name id staffid mobilerightsid rights id rightname 1 John null null null null 1 login 1 John null null null null 2 View 2 Fred null null null null 1 login 2 Fred null null null null 2 View I have tried the following : SELECT * FROM STAFFMOBILERIGHTS SMR RIGHT JOIN STAFF STA ON STA.STAFFID = SMR.STAFFID RIGHT JOIN MOBILERIGHTS MRI ON MRI.ID = SMR.MOBILERIGHTSID But this only returns two rows as follows: id name id staffid mobilerightsid rights id rightname null null null null null null 1 login null null null null null null 2 View Can what I am trying to achieve be done and if so how? Thanks

    Read the article

  • How to avoid timestamp issue in a long query?

    - by pingi
    Hi, I have the following 2 tables: items: id int primary key bla text events: id_items int num int when timestamp without time zone ble text composite primary key: id_items, num and want to select to each item the most recent event (the newest 'when'). I wrote an request, but I don't know if it could be written more efficiently. Also on PostgreSQL there is a issue with comparing Timestamp objects: 2010-05-08T10:00:00.123 == 2010-05-08T10:00:00.321 so I select with 'MAX(num)' Any thoughts how to make it better? Thanks. SELECT i.*, ea.* FROM items AS i JOIN ( SELECT t.s AS t_s, t.c AS t_c, max(e.num) AS o FROM events AS e JOIN ( SELECT DISTINCT id_item AS s, MAX(when) AS c FROM events GROUP BY s ORDER BY c ) AS t ON t.s = e.id_item AND e.when = t.c GROUP BY t.s, t.c ) AS tt ON tt.t_s = i.id JOIN events AS ea ON ea.id_item = tt.t_s AND ea.cas = tt.t_c AND ea.num = tt.o;

    Read the article

  • mysql boolean joins

    - by user280381
    I want to use a JOIN to return a boolean result. Here's an example of the data... t1 id | data | 1 | abcd | 2 | 2425 | 3 | xyz | t2 id | data | t1_id | 1 | 75 | 2 | 2 | 79 | 2 | 3 | 45 | 3 | So with these two tables I want to select all the data from t1, and also whether a given variable appears in t2.data for each id. So say the variable is 79, the results should be id | data | t2_boolean 1 | abcd | 0 2 | abcd | 1 3 | xyz | 0 So I'm thinking some sort of join is needed, but without a WHERE clause. I've been banging my head about this one. Is it possible? I really need it inside the same statement as I want to sort results by the boolean field. As the boolean needs to be a field, can I put a join inside of a field? Thanks...

    Read the article

  • Improving the join of two wave file?

    - by kaki
    I have written a code for joining two wave files.It works fine when i am joining larger segments but as i need to join very small segments the clarity is not good. I have learned that the signal processing technique such a windowed join can be used to improve the joining of file. y[n] = w[n]s[n] Multiply value of signal at sample number n by the value of a windowing function hamming window w[n]= .54 - .46*cos(2*Pi*n)/L 0 I am not understanding how to get the value to signal at sample n and how to implement this?? the code i am using for joining is import wave m=['C:/begpython/S0001_0002.wav', 'C:/begpython/S0001_0001.wav'] i=1 a=m[i] infiles = [a, "C:/begpython/S0001_0002.wav", a] outfile = "C:/begpython/S0001_00367.wav" data= [] data1=[] for infile in infiles: w = wave.open(infile, 'rb') data1=[w.getnframes] data.append( [w.getparams(), w.readframes(w.getnframes())] ) #data1 = [ord(character) for character in data1] #print data1 #data1 = ''.join(chr(character) for character in data1) w.close() output = wave.open(outfile, 'wb') output.setparams(data[0][0]) output.writeframes(data[0][1]) output.writeframes(data[1][1]) output.writeframes(data[2][1]) output.close()

    Read the article

  • In SQL, we can use "Union" to merge two tables. What are different ways to do "Intersection"?

    - by Jian Lin
    In SQL, there is an operator to "Union" two tables. In an interview, I was told that, say one table has just 1 field with 1, 2, 7, 8 in it, and another table also has just 1 field with 2, and 7 in it, how do I get the intersection. I was stunned at first, because I never saw it that way. Later on, I found that it is actually a "Join" (inner join), which is just select * from t1, t2 where t1.number = t2.number (although the name "join" feels more like "union" rather than "intersect") another solution seems to be select * from t1 INTERSECT select * from t2 but it is not supported in MySQL. Are there different ways to get the intersection besides these two methods?

    Read the article

  • mysql multiple where and inner join query combination

    - by bandhunt
    I'm a little lost as how to run two mysql queries as one(return one result set to be sorted etc). I understand how to do multiple JOINS but need to combine the below which is more than just a multiple join - it would include a multiple where etc. 1st query sql = "SELECT s.id, s.song_name FROM `songs` as s INNER JOIN `artists` as a ON s.artist_id = a.id WHERE ((`a`.id = #{search}))" 2nd query sql = "SELECT s.id, s.song_name FROM `songs` as s INNER JOIN `similarments` as si ON s.artist_id = si.artist_id WHERE ((`si`.similar_id = #{search}))" And then run both queries at once so I can ORDER them etc. Or combine them as one big query (maybe put an OR somewhere)? Thanks!

    Read the article

  • SQL Server JOIN with optional NULL values

    - by Paul McLoughlin
    Imagine that we have two tables as follows: Trades ( TradeRef INT NOT NULL, TradeStatus INT NOT NULL, Broker INT NOT NULL, Country VARCHAR(3) NOT NULL ) CTMBroker ( Broker INT NOT NULL, Country VARCHAR(3) NULL ) (These have been simplified for the purpose of this example). Now, if we wish to join these two tables on the Broker column, and if a country exists in the CTMBroker table on the Country, we have the following two choices: SELECT T.TradeRef,T.TradeStatus FROM Trades AS T JOIN CTMBroker AS B ON B.Broker=T.Broker AND ISNULL(B.Country, T.Country) = T.Country or SELECT T.TradeRef,T.TradeStatus FROM Trades AS T JOIN CTMBroker AS B ON B.Broker=T.Broker AND (B.COUNTRY=T.Country OR B.Country IS NULL) These are both logically equivalent, however in this specific circumstance for our database (SQL Server 2008, SP1) two different execution plans are produced for these two queries with the second version significantly outperforming the first version in terms of both time and logical reads. My question really is as follows: as a general rule would (2) be preferred to (1), or does this just happen to be exploiting some particular idiosyncracy of the optimiser in 2008 SP1 (that could therefore change with future versions of SQL Server).

    Read the article

  • LINQ - Using where or join - Performance difference ?

    - by Patrick Säuerl
    Hi Based on this question: http://stackoverflow.com/questions/3013034/what-is-difference-between-where-and-join-in-linq My question is following: Is there a performance difference in the following two statements: from order in myDB.OrdersSet from person in myDB.PersonSet from product in myDB.ProductSet where order.Persons_Id==person.Id && order.Products_Id==product.Id select new { order.Id, person.Name, person.SurName, product.Model,UrunAdi=product.Name }; and from order in myDB.OrdersSet join person in myDB.PersonSet on order.Persons_Id equals person.Id join product in myDB.ProductSet on order.Products_Id equals product.Id select new { order.Id, person.Name, person.SurName, product.Model,UrunAdi=product.Name }; I would always use the second one just because it´s more clear. My question is now, is the first one slower than the second one? Does it build a cartesic product and filters it afterwards with the where clauses ? Thank you.

    Read the article

  • Selecting the first row out of many sql joins

    - by IcedDante
    Alright, so I'm putting together a path to select a revision of a particular novel: SELECT Catalog.WbsId, Catalog.Revision, NovelRevision.Revision FROM Catalog, BookInCatalog INNER JOIN NovelMaster INNER JOIN HasNovelRevision INNER JOIN NovelRevision ON HasNovelRevision.right = NovelRevision.obid ON HasNovelRevision.Left=NovelMaster.obid ON NovelMaster.obid = BookInCatalog.Right WHERE Catalog.obid = BookInCatalog.Left; This returns all revisions that are in the Novel Master for each Novel Master that is in the catalog. The problem is, I only want the FIRST revision of each novel master in the catalog. How do I go about doing that? Oh, and btw: my flavor of sql is hobbled, as many others are, in that it does not support the LIMIT Function.

    Read the article

  • I can't understand GroupJoin where i will need it in database relationships.

    - by Freshblood
    Hello Everybody I am thinking 5-6 hours to understand something about GroupJoin. I am talking about query with linq for Database tables.I understand what Join and GroupJoin does but I really couldn't understand where i will need it.I feel that Join does all what i will need but if there is something which Join can't without GroupJoin so i feel that situation is meaningless or useless. For example: Persons table in relation with Phones and Phones table hold foreign keys of Persons and one person can have one more phone number.If we want to brings all persons who has phone numbers and who hasn't too so we will need GroupJOin but what for we will need this query ? Can u give me good reason , example or explenation for using GroupJoin ?

    Read the article

  • MYSQL: COUNT with GROUP BY, LEFT JOIN and WHERE clause doesn't return zero values

    - by Paul Norman
    Hi guys, thanks in advance for any help on this topic! I'm sure this has a very simply answer, but I can't seem to find it (not sure what to search on!). A standard count / group by query may look like this: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` GROUP BY `t1`.`any_col` and this works as expected, returning 0 if no rows are found. So does: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` WHERE `t1`.`another_column` = 123 However: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` WHERE `t1`.`another_column` = 123 GROUP BY `t1`.`any_col` only works if there is at least one row in table_1 and fails miserably returning an empty result set if there are zero rows. I would really like this to return 0! Anyone enlighten me on this? Beer can be provided in exchange if you are in London ;-)

    Read the article

  • Do i need to join Graphics Card with CPU fan

    - by Mirage
    Initially i had inno 3d 256MB Nvidia GTS graphics card. I also had another Big FAN above the processor (Vendor put in quad core) In that card there was one cable which was joined with that FAN. Now i have changed the CARD to 1GB Nvidia GT9600 . But there is no pins to join the fan with that card. Is it ok . i don't know why old card was joined with FAN

    Read the article

  • Tried to join a workgroup but now can't loginto system

    - by Ali
    Help - I tried to join a workgroup but now all of a sudden I can't log into my system. I get an account not found error - also for some reason when I click the options button on the log in screen I can't see the domain option at all.. whats going on! I can't even log in using the adminstrator login or anything!!

    Read the article

  • Account to read AD, join machine to domain, delete computer accounts and move computers to OUs

    - by Ben
    I want to create an account that will perform the following: Join computers to a domain (not restricted to 10, like a normal user) Check for computer accounts in AD Delete computers from AD Move computers between OUs I don't want to allow it to do anything else, so don't want a domain admin account. Can anyone guide me in the right direction in terms of permissions? Not sure if I should be using delegation of control wizard? Cheers, Ben

    Read the article

  • join ubuntu server 11.10 to a windows server dns

    - by eyadof
    i have been installed ubuntu server 11.10 and i doesn't specify the domain name during the installation but after i have been edit /ete/resolve.conf with my dns servers which run windows server the dns can't recognise my server name . then i installed likewise-open but that doesn't solve the problem and make some problems with ftp . can someone help me please to join this server to the dns . thanks in advance .

    Read the article

  • join videos split screen

    - by Richard
    I am looking for a command line tool to join 2 video files, however I want the videos joined split screen frame by frame instead of one after another. Any ideas? Seems this is not possible with ffmpeg.

    Read the article

  • Active Directory - Join domain in specific OU when its a workstation

    - by Jonathan Rioux
    I would like to know how can I accomplish the following: When I join a workstation (with Windows 7) in the domain, I want that computer to be put into a specific OU. Only when its a workstation with Windows 7. This is because I have GPOs that must apply to all workstations in the domain. Can I only accomplish this using a script? Or can I set a rule like if the computers has Windows 7, put that computer into this specific OU.

    Read the article

  • Successfully concatenating multiple videos

    - by wiseguydigital
    My mission is to create videos out of old web slideshows. To start with I have jpegs and audio files that worked as Flash slideshows in an old system, structured such as this: Audio structure my_audio_1.mp3 (this file is a 3 second mp3 of silence) my_audio_2.mp3 my_audio_3.mp3 my_audio_4 etc... roughly 30 mp3s per slideshow Image structure my_image_1.jpg (this acts as the opening slide) my_image_2.jpg my_image_3.jpg my_image_4. etc... roughly 30 images per slideshow. As there are almost 100 slideshows that must be converted to video, I have created a web-based interface using PHP to automate the process, that sits on a local system and attempts to combine the files using shell_exec(). The process uses the following workflow: Loop through each slide and make an avi or mpeg. So for instance my_mini_video_2.avi would be a video that consists of my_image_2.jpg and has a soundtrack of my_audio_2.mp3. This slide would last the length of my_audio_2.mp3. Join / stitch / concat all of the mini videos to create the final video (Using a combination of cat and either mencoder or ffmpeg (I have also tried avimerge but to no avail). Transcode the new 'master' video to various formats such as flv etc. I thought this would be simple and have been close on many occasions but it still won't work. I can't get past stage 2 as I can't get a perfect 'master' video. I have now experimented with Mencoder, FFMpeg and seem to have been through every combination I can think of. The problem is that the audio and visuals never sync, no matter what I try. Also, I have even tried created audio-less mini videos, joining the MP3s into one long MP3 using both cat and mp3wrap and then assigning the new long MP3 as the audio track, but this always produces either a very short file or a badly slowed down file and makes the female voiceover sound like a male boxer!!! There appears to be no problems at all with the original files. Does anybody have any experience in producing a video successfully from the same kind of starting point? Or any ideas on what I may be doing wrong? As an example: If I create silent mini-videos, and stitch them together into 'temp-master.mpg' and then join the MP3s together into single MP3 called 'temp-master-audio.mp3', the audio file's duration is 09:10 and the video file's duration is 08:35. They should be the same and the audio will seem sloooow. I haven't posted code as I have written lots and lots of combinations.

    Read the article

  • ffmpeg - join / merge on top of each other

    - by AisIceEyes
    I'm trying to join together two videos on top of each other. I already did these two ffmpeg commands ffmpeg -i 2_Out_of_Control.VOB -aspect 16:9 \ -vf "yadif=0:-1:0,crop=w=714:h=476:x=6:y=0,scale=1280:720,boxblur=lp=13" \ -c:v libx264 -preset medium \ -c:a copy \ '2(blurred)Out_of_Control.mp4' ffmpeg -i 2_Out_of_Control.VOB \ -vf "yadif=0:-1:0,crop=w=714:h=476:x=6:y=0,scale=1080:720" \ -c:v libx264 -preset medium \ -c:a copy \ '2(clear)Out_of_Control.mp4' I'm currently stuck on making the "clear" version on top of the "blurred" version. I'm not sure how to do that. Can anybody help please? Been googling for around 2 days already. Only achieved it by using OpenShot but yeah, would prefer if there is an ffmpeg command to merge the two videos on top of each other. Edit: I want the "clear" video to be at the center at the top of the "blurred" video Edit2: console output would be the same as above: ffmpeg -i 2(blurred)Out_of_Control.mp4 \ -i 2(clear)Out_of_Control.mp4 \ -aspect 16:9 \ -vf <just something that will join the two together: the blurred at the bottom, clear at top that is centered> \ -c:v libx264 -preset medium \ -c:a copy \ '2_Out_of_Control_VOB.mp4' Edit3: here is the output when I used ffmpeg -i 2_Out_of_Control.VOB $ ffmpeg -i 2_Out_of_Control.VOB ffmpeg version git-2013-10-03-c7fe2a3 Copyright (c) 2000-2013 the FFmpeg developers built on Oct 4 2013 05:22:06 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --prefix=/home/username/ffmpeg_build --extra-cflags=-I/home/username/ffmpeg_build/include --extra-ldflags=-L/home/username/ffmpeg_build/lib --bindir=/home/username/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab libavutil 52. 46.100 / 52. 46.100 libavcodec 55. 34.100 / 55. 34.100 libavformat 55. 19.100 / 55. 19.100 libavdevice 55. 3.100 / 55. 3.100 libavfilter 3. 88.101 / 3. 88.101 libswscale 2. 5.100 / 2. 5.100 libswresample 0. 17.103 / 0. 17.103 libpostproc 52. 3.100 / 52. 3.100 Input #0, mpeg, from '2_Out_of_Control.VOB': Duration: 00:05:00.01, start: 0.500000, bitrate: 4574 kb/s Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 8:9 DAR 4:3], max. 9334 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s At least one output file must be specified $

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >