Search Results

Search found 9764 results on 391 pages for 'cross join'.

Page 43/391 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • Using subselect to accomplish LEFT JOIN

    - by Andre
    Is is possible to accomplish the equivalent of a LEFT JOIN with subselect where multiple columns are required. Here's what I mean. SELECT m.*, (SELECT * FROM model WHERE id = m.id LIMIT 1) AS models FROM make m As it stands now doing this gives me a 'Operand should contain 1 column(s)' error. Yes I know this is possible with LEFT JOIN, but I was told it was possible with subselect to I'm curious as to how it's done.

    Read the article

  • Using a join model to relate a model to itself

    - by Gabe Hollombe
    I have two models: User MentoringRelationship MentoringRelationship is a join model that has a mentor_id column and a mentee_id column (both of these reference user_ids from the users table). How can I specify a relation called 'mentees' on the User class that will return all of the users mentored by this user, using the MentoringRelationships join table? What relations do we need to declare in the User model and in the MentoringRelationship model?

    Read the article

  • Nhibernate - Getting Exception when run a simple join query

    - by Muhammad Akhtar
    hi, I am getting issue when I run sql Query having inner join, here is what I am doing very simple ISession session = NHibernateHelper.GetCurrentSession(); string query = string.Format("select Documents.TypeId from Documents inner join DocumentTrackingItems on Documents.Id = DocumentTrackingItems.DocumentId WHERE DocumentTrackingItems.ItemStepId = {0} order by Documents.TypeId asc", 13); System.Collections.ArrayList document = (System.Collections.ArrayList)session.CreateSQLQuery(query, "document", typeof(Document)).List(); I am getting this exception Exception Details: System.IndexOutOfRangeException: Id what's wrong in my query? --- thanks

    Read the article

  • MySQL database query returns empty result

    - by user1791096
    I am doing a data migration and getting empty result of simple query with one join. Following is the query Select * from users u INNER JOIN temp_users tu ON tu.uid = u.uid There hundreds of records which have same uid in both tables, but this query returns only one record. Following is the structure of tables users table uid: varchar(50) utf8_general_ci Yes NULL temp_users table uid: varchar(50) utf8_general_ci Yes NULL Is there anyone who faced same problem?

    Read the article

  • Insert a Join Statement - (Insert Data to Multiple Tables) - C#/SQL/T-SQL/.NET

    - by peace
    I have a Winform that has fields need to be filled by a user. All the fields doesn't belong to one table, the data will go to Customer table and CustomerPhone table, so i decided to do multiple inserts. I will insert appropriate data to CustomerPhone first then Insert the rest data to Customer table. Is it possible to Join an Insert OR Insert a Join? If show me a rough sample, i will be grateful. Many Thanks

    Read the article

  • SQL - Outer Join 2 queries?

    - by Stuav
    I have two querys. Query 1 gives me this result: Day New_Users 01-Jan-12 45 02-Jan-12 36 and so on. Query 2 gives me this result: Day Retained_Users 01-Jan-12 33 02-Jan-12 30 and so on. I want a new query that will join this together and read: Day New_Users Retained_Users 01-Jan-12 45 33 02-Jan-12 36 30 Do I use some sort of outer join?

    Read the article

  • Left Outer Join on Many-to-One Mapping

    - by Colin Bowern
    I have a reference to call that may or may not be there. When I add the nullable option it still doing Inner Join when I want an Outer Left Join (show the left even if the right is null). Is this possible in the NH map? References(x => x.DefaultCategory, "CATEGORY_ID") .Nullable();

    Read the article

  • Hibernate custom join clause on association

    - by myso
    I would like to associate 2 entities using hibernate annotations with a custom join clause. The clause is on the usual FK/PK equality, but also where the FK is null. In SQL this would be something like: join b on a.id = b.a_id or b.a_id is null From what I have read I should use the @WhereJoinTable annotation on the owner entity, but I'm puzzled about how I specify this condition...especially the first part of it - referring to the joining entity's id. Does anyone have an example?

    Read the article

  • innerJoin query show error

    - by Chithri Ajay
    just i print the two table data so i am using inner join SELECT sd.GameName FROM LottoryTickets AS sd JOIN group AS p ON sd.Group = p.groupname WHERE p.groupname = 11 now i get #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group AS p ON sd.Group = p.groupname WHERE p.groupname = 11 LIMIT 0, 30' at line 3 this response please guide me thanks for advance.

    Read the article

  • Doctrine join enitiy or null

    - by Medvedev
    I have an entity Entity\User with avatar: /** * @ORM\OneToOne(targetEntity="Entity\Avatar", cascade={"remove"}, fetch="LAZY") */ protected $avatar; And Entity\Message entity /** * @ORM\ManyToOne(targetEntity="Entity\User") */ protected $user; When i try to load all messages with users and avatars. But not all user have avatar. SELECT m, u, a FROM Entity\Message m JOIN m.user u JOIN u.avatar a ORDER BY m.id DESC How to load all messages with user who avatars and who does not have?

    Read the article

  • MySQL join problem

    - by snaken
    Whats wrong with this SQL? It should return results but returns nothing SELECT `pid` FROM `products` LEFT JOIN `prods_to_features` ON (`ptf_pid` = `pid`) WHERE (`ptf_id` = '66' OR `ptf_id` = '67') AND (`ptf_id` = '76') Is it not possible to have the 2nd where clause for the table that has been used in the left join?

    Read the article

  • MySQL search for user and their roles

    - by Jenkz
    I am re-writing the SQL which lets a user search for any other user on our site and also shows their roles. An an example, roles can be "Writer", "Editor", "Publisher". Each role links a User to a Publication. Users can take multiple roles within multiple publications. Example table setup: "users" : user_id, firstname, lastname "publications" : publication_id, name "link_writers" : user_id, publication_id "link_editors" : user_id, publication_id Current psuedo SQL: SELECT * FROM ( (SELECT user_id FROM users WHERE firstname LIKE '%Jenkz%') UNION (SELECT user_id FROM users WHERE lastname LIKE '%Jenkz%') ) AS dt JOIN (ROLES STATEMENT) AS roles ON roles.user_id = dt.user_id At the moment my roles statement is: SELECT dt2.user_id, dt2.publication_id, dt.role FROM ( (SELECT 'writer' AS role, link_writers.user_id, link_writers.publication_id FROM link_writers) UNION (SELECT 'editor' AS role, link_editors.user_id, link_editors.publication_id FROM link_editors) ) AS dt2 The reason for wrapping the roles statement in UNION clauses is that some roles are more complex and require a table join to find the publication_id and user_id. As an example "publishers" might be linked accross two tables "link_publishers": user_id, publisher_group_id "link_publisher_groups": publisher_group_id, publication_id So in that instance, the query forming part of my UNION would be: SELECT 'publisher' AS role, link_publishers.user_id, link_publisher_groups.publication_id FROM link_publishers JOIN link_publisher_groups ON lpg.group_id = lp.group_id I'm pretty confident that my table setup is good (I was warned off the one-table-for-all system when researching the layout). My problem is that there are now 100,000 rows in the users table and upto 70,000 rows in each of the link tables. Initial lookup in the users table is fast, but the joining really slows things down. How can I only join on the relevant roles? -------------------------- EDIT ---------------------------------- Explain above (open in a new window to see full resolution). The bottom bit in red, is the "WHERE firstname LIKE '%Jenkz%'" the third row searches WHERE CONCAT(firstname, ' ', lastname) LIKE '%Jenkz%'. Hence the large row count, but I think this is unavoidable, unless there is a way to put an index accross concatenated fields? The green bit at the top just shows the total rows scanned from the ROLES STATEMENT. You can then see each individual UNION clause (#6 - #12) which all show a large number of rows. Some of the indexes are normal, some are unique. It seems that MySQL isn't optimizing to use the dt.user_id as a comparison for the internal of the UNION statements. Is there any way to force this behaviour? Please note that my real setup is not publications and writers but "webmasters", "players", "teams" etc.

    Read the article

  • MySQL doesn't use index in join query

    - by Kocsonya Laci
    I have two tables: comments(id(primary key), author, ip(index)) and visitors(id(primary key), date_time, ip(index)) I want to join them like that: SELECT visitors.date_time FROM comments LEFT JOIN visitors ON ( comments.ip = visitors.ip ) WHERE comments.author = 'author' LIMIT 10 It works, but very slow.. In EXPLAIN it shows that it doesn't use the index on the visitors table: id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE comments ref author author 78 const 9660 Using where 1 SIMPLE visitors ALL NULL NULL NULL NULL 8033 Any ideas? Thanks!

    Read the article

  • NHibernate join and projection properties

    - by devgroup
    Hello, I have simple situation (like on the image link text) and simple SQL query SELECT M.Name, A.Name, B.Name FROM Master M LEFT JOIN DetailA A ON M.DescA = A.Id LEFT JOIN DetailB B ON M.DescB = B.Id How to achive the same effect in nHibernate using CriteriaAPI ?

    Read the article

  • Mysql filling in missing dates

    - by bsandrabr
    I have the following query SELECT * FROM attend RIGHT OUTER JOIN noattend ON attend.date = noattend.date2 WHERE attend.date BETWEEN '2010-02-01' AND '2010-04-01' AND attend.customerid =1 ORDER BY date DESC LIMIT 0 , 30 Attend is the table with customerid noattend is the table with a row for each date (date2) I followed the advice in other questions to right outer join it to create values where there is no record in attend but it still isn't filling in the empties any help much appreciated

    Read the article

  • Difference between "and" and "where" in joins

    - by Midhat
    Whats the difference between SELECT DISTINCT field1 FROM table1 cd JOIN table2 ON cd.Company = table2.Name and table2.Id IN (2728) and SELECT DISTINCT field1 FROM table1 cd JOIN table2 ON cd.Company = table2.Name where table2.Id IN (2728) both return the same result and both have the same explain output

    Read the article

  • CONCAT_WS rows in JOIN

    - by Alex Kiselev
    i have tables profiles (id, name, deleted) categories (id, name, deleted) profiles_categories (id, profile_id, category_id, , deleted) I have wrong query SELECT p.id, p.name CONCAT_WS(', ', c.name) AS keywords_categories FROM profiles p LEFT JOIN profiles_categories pc ON p.id = pc.profile_id LEFT JOIN categories c ON pc.id = c.id WHERE p.deleted = FALSE So, i want have result with all profiles with concan categories.name. Thanks

    Read the article

  • Remote Desktop Client Crashes following domain join

    - by Roberto Charlie Ciarleglio
    I recently joined my laptop to our windows domain and now the remote desktop client crashes when i try and connect to any machine. It works if I run as administrator but not ordinarily. The domain join migrated my local profile to the domain profile which i think is where the problem lies. I'm guessing its a permission thing as I had a similar problem with dropbox and had to delete reg keys and reinstall. I can't figure out how to fix this problem though. The event viewer shows this: Faulting application name: mstsc.exe, version: 6.1.7601.17514, time stamp: 0x4ce7ab44 Faulting module name: FACredProv2.dll, version: 2.4.95.1, time stamp: 0x4bb8d766 Exception code: 0xc0000005 Fault offset: 0x00000000000025b2 Faulting process id: 0xb24 Faulting application start time: 0x01cd43fbd3a81fba Faulting application path: C:\Windows\System32\mstsc.exe Faulting module path: C:\Windows\System32\FACredProv2.dll Report Id: 154ee55a-afef-11e1-a443-b8ac6f704c5d any help would be appreciated!

    Read the article

  • How can I rip a DVD but merge/join episodes

    - by Nifle
    Some background. I have the Pink Panther Collection, they have about 30 episodes on each DVD. Now I want to watch this on my $MobileDevice. So I went and converted it to m4v or avi. This of course went splendid with both Handbrake and AutoGK but the problem is that I want ONE file per DVD, both Handbrake and AutoGK creates one file per episode. So here finally is my question. Does anyone know how to persuade Handbrake or AutoGK to create one video file with all the episodes? Or can anyone recommend another (free/cheep) tool for the job? Oh and no cheating by telling me to join the files after conversion. I have never found a video joiner that did not disappoint me (usually bad audio sync).

    Read the article

  • Netdom Join Failed To Complete Successfully

    - by BubbleMonster
    I have two servers on VMWare. One is a standard install of Server 2008 r2 and the other is Server 2008 core. Server 2008's IP is: 192.168.186.135 and computer name is: SERVER01. This is a domain controller and has DNS installed along with Active Directory. The domain is called: contoso.com Server 2008 Core's IP is: 192.168.186.137 and computer name is: SERVER02 They can both ping each other, but when I try running the following: netdom join SERVER02 /domain:contoso.com Results: The specified domain either does not exist or could not be contacted. The command failed to complete successfully. I'm thinking it might be a DNS issue? I'm new to servers and I am teaching myself. Any help would be appreciated. Thanks in advance.

    Read the article

  • Join domain in windows 7 [on hold]

    - by Hassan Ali Khan
    I have created a domain on server machine and when i am trying to join a domain through another machine of windows 7 through the following steps: Goto MY Computer Properties - Change settings - ComputerName - click on change button - click on radio button "Domain" and enter domain name. After that when i click on OK button and enter the username and password credentials. It show me the following error: An attempt to resolve the DNS name of a domain controller in the domain being joined has failed. Please verify this client is configured to reach a DNS server that can resolve DNS names in the target domain

    Read the article

  • Cannot Join a Domain on VM

    - by arvind0007
    Hi Guys. I have installed Windows 2003 server R2 on a VM. This VM is running on Windows XP PRO. When i try to make this XP Pro PC join the domain on the VM it tries to locate the server and gives me the following error message " The specified network name is no longer available", despite the fact that i can still see this domain on my network. can anyone help with this please. This is the very first time i am trying connecting a client to a VM server so hope am not doing anything wrong.. thanks

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >