Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

SQL join help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SQL join help

    Lack of SQL know-how here, I think.

    I set up a grid with a select statement that includes a right outer join. This means I display all records in TableA, but only matching records in TableB.

    The grid displays exactly what I want, and no other join configuration gets me what I want.

    But, when I try to enter records in TableB, the grid returns this error:

    Record was not updated because it has been deleted by another user

    Dunno what to do about this. Any ideas?
    -Steve
    sigpic

    #2
    Re: SQL join help

    Right outer I thought was all of table b and any matching table a
    Chad Brown

    Comment


      #3
      Re: SQL join help

      Well, I've tried both left and right. There's a nice little helper in the SQL genie that helps me at least get and display the right data.

      But the result is the same in either case - I get the same error message.
      -Steve
      sigpic

      Comment


        #4
        Re: SQL join help

        Steve,

        Try building the join into a view, then base the grid on the view instead of an SQL statement. That would be easier for Alpha to deal with.

        Pat
        Pat Bremkamp
        MindKicks Consulting

        Comment


          #5
          Re: SQL join help

          Can I see some sequel code

          Comment


            #6
            Re: SQL join help

            Well, again my SQL falls short. I don't know how to create a view. I think I need something like this:

            CREATE VIEW English_to_Translate AS
            SELECT English_ID AS English_ID1, Word FROM lang_englishmaster
            SELECT Language_id, English_ID AS English_ID2, Translate_ID, Translate, Available FROM lang_translation
            LEFT OUTER JOIN lang_englishmaster lang_translation
            ON English_ID = English_ID;



            Any help appreciated.
            -Steve
            sigpic

            Comment


              #7
              Re: SQL join help

              I took Pat's advice, and got some help from Chad, and still no joy. I set up view with a left outer join, and still get the same error when working with the grid.

              I'm using Toad to help with MySQL. When I try to enter data in the View via Toad, my error is:

              Can not modify more than one base table through a join view 'test.eng_to_tran'

              So, I guess I'm back to a basic question:

              I have TableA that is a master list of words.

              TableB will be the list of words in another language.

              I'd like to have a grid that displays all the records in TableA, and gives the user a field to enter the translated word into TableB.

              This should be simple, but so far no solution. Any ideas?

              If anyone finds it useful, here's my SQL to create the view:

              CREATE VIEW {{Unquote(:Table_Name)}} AS
              SELECT lang_englishmaster.English_ID AS EnglsihID1
              , lang_englishmaster.Word
              , lang_translation.Language_id
              , lang_translation.English_ID AS EnglishID2
              , lang_translation.Translate_ID
              , lang_translation.Translate
              , lang_translation.Available
              FROM
              test.lang_englishmaster lang_englishmaster
              LEFT OUTER JOIN
              test.lang_translation lang_translation
              ON (lang_englishmaster.English_ID = lang_translation.English_ID)
              ORDER BY lang_englishmaster.Word ASC
              -Steve
              sigpic

              Comment


                #8
                Re: SQL join help

                You can't insert into view ! but can update, as far as I know.

                Any modifications, including UPDATE, INSERT, and DELETE statements, must reference columns from only one base table.
                I found this here: http://technet.microsoft.com/en-us/l.../ms187956.aspx

                Comment


                  #9
                  Re: SQL join help

                  Originally posted by Steve Workings View Post
                  I took Pat's advice, and got some help from Chad, and still no joy. I set up view with a left outer join, and still get the same error when working with the grid.

                  I'm using Toad to help with MySQL. When I try to enter data in the View via Toad, my error is:

                  Can not modify more than one base table through a join view 'test.eng_to_tran'

                  So, I guess I'm back to a basic question:

                  I have TableA that is a master list of words.

                  TableB will be the list of words in another language.

                  I'd like to have a grid that displays all the records in TableA, and gives the user a field to enter the translated word into TableB.

                  This should be simple, but so far no solution. Any ideas?

                  If anyone finds it useful, here's my SQL to create the view:

                  CREATE VIEW {{Unquote(:Table_Name)}} AS
                  SELECT lang_englishmaster.English_ID AS EnglsihID1
                  , lang_englishmaster.Word
                  , lang_translation.Language_id
                  , lang_translation.English_ID AS EnglishID2
                  , lang_translation.Translate_ID
                  , lang_translation.Translate
                  , lang_translation.Available
                  FROM
                  test.lang_englishmaster lang_englishmaster
                  LEFT OUTER JOIN
                  test.lang_translation lang_translation
                  ON (lang_englishmaster.English_ID = lang_translation.English_ID)
                  ORDER BY lang_englishmaster.Word ASC
                  How about using a trigger to create a record in table b automatically when a record is created in table a. Allow null values in the translated field. Then when the view is used you are updating an existing record rather than trying to create a new record?

                  There is also a typo in the sql you posted on line 2 for the alias name?
                  Glen Schild



                  My Blog

                  Comment


                    #10
                    Re: SQL join help

                    OK, ya'll are confirming what I thought - I need to re-think my approach. Should be easy for me but kinda overloaded and as inventive as usual I guess.
                    -Steve
                    sigpic

                    Comment


                      #11
                      Re: SQL join help

                      Steve,
                      You have probably figured out a solution by now, but maybe this will help:
                      Updating a view suggested by Atta is correct - you can, but only one side OR the other but not both.
                      Adding through a view is not possible because if you think about the two tables side by side, if there isn't a record on side B, there is nowhere for the data to go.
                      Glenshild suggested creating the B side record when you create the A side record, but I'm assuming that you are building multiple B side tables to be able to translate multiple languages, so you can't be triggering new records in all the possible B side language record sets - not efficient - and not to mention that when you add a new language set to the B side, you'd have to pre-create all those B side records.
                      Couple of solutions here:
                      One solution I can think of is a combination of both suggestions from Atta and Glenshild. Use the view but add an Add button to the B side so that when you click it it will run an SQL insert to create the B side record and then you will have a container on the B side for your data, then refresh the underlying query (or does Ajax do that automatically for you?).
                      Second one would be to add a Detail View to the grid, allowing Add (or maybe only Add), pre-populate the EnglishID key field with the A side key field and only select B side fields to be displayed in the Detail View. FYI, this second approach is pure hypothesis as I haven't actually done this!
                      As a variation on either version, can you hijack the save button using the java events and make it run a manual SQL insert with the new data?
                      A third possibility is to implement the B side as a Drop Down Box and enter Not in List Rule as the B side. Again hypothesis as I'm not sure how you would make sure that you create the new Drop Down Record with the EnglishID key.
                      -Rob
                      p.s. I'll trade you SQL work by me for AlphaFive Web coaching from you if you'd be interested.

                      Comment


                        #12
                        Re: SQL join help

                        This should be simple:

                        Code:
                        INSERT INTO lang_workarea(english_id,word)
                           SELECT english_id,word FROM lang_englishmaster
                        Both tables have identical fields. Yet it fails, and I don't know why. Help?
                        -Steve
                        sigpic

                        Comment


                          #13
                          Re: SQL join help

                          Steve,

                          Check the error being returned. Try the following code:

                          Code:
                          Dim conn as SQL::Connection
                          Dim strSQL as C
                          
                          Dim flag as L
                          Dim strResult as C
                          
                          conn.TraceSQL=.T.
                          flag = conn.open("::name::myconnection")  
                          if (flag == .f.) then
                          	ui_msg_box("ERROR","Unable to open connection: conn",UI_ATTENTION_SYMBOL+UI_OK)
                          	end
                          end if
                          
                          strSQL = "INSERT INTO lang_workarea(english_id,word) SELECT english_id,word FROM lang_englishmaster"
                          flag=conn.Execute(strSQL)
                          strResult = conn.CallResult.NativeText
                          if (flag == .f.) then
                              	ui_msg_box("SQL Error","Failed: "+strResult,UI_OK)
                          end if
                          
                          conn.close()
                          Thanks,

                          Robert
                          Last edited by workaholic06; 07-25-2010, 12:08 AM. Reason: typo
                          Earl Allin
                          REAInc.net

                          We can help you with mentoring and custom programming services in Alpha, .NET, React, PHP, ColdFusion, and more..

                          Comment


                            #14
                            Re: SQL join help

                            Steve what is the where statement?
                            Originally posted by Steve Workings View Post
                            This should be simple:

                            Code:
                            INSERT INTO lang_workarea(english_id,word)
                               SELECT english_id,word FROM lang_englishmaster
                            Both tables have identical fields. Yet it fails, and I don't know why. Help?
                            Chad Brown

                            Comment


                              #15
                              Re: SQL join help

                              Originally posted by chadbrown View Post
                              Steve what is the where statement?

                              I don't think he had a WHERE clause - looks like he was transferrinig all the records.

                              My bet is that the table lang_workarea already has entries, and he's duplicating the english_id value with another record. Of course, another assumption would be that his english_id column has an index of Primary or Unique.
                              Earl Allin
                              REAInc.net

                              We can help you with mentoring and custom programming services in Alpha, .NET, React, PHP, ColdFusion, and more..

                              Comment

                              Working...
                              X