2 Replies Latest reply on Dec 8, 2006 4:50 PM by proxim00

    Help with SQL

    proxim00
      Hi everyone, I have been trying to figure this out all day and nothing seems to work. So this is the situation, I have a site that will have multiple tables for each product category, this was done because I am useing a script to upload xls docs and insert them into the DB, anyhow I want to creat a search for the site. My problem is how would I be able to search all the tables and return the results?

      So I have table1 - 5 right each one needs to be searched for keyword of say "gem stone" and then return the results Im assuming with one query. I have tried to do Full join, Unions etc but none of them seem to work right. I had some success with Full Join but when I tried to add in additional tables it crapped out on me. I don't need a where clase just need to grab the records in a view them query it from the code. I guess my real question is what should I use to do this?

      Once I know what way to approch it I think I should be fine but for the life of me I cant get it working

      Thanks for any help you all can give
        • 1. Re: Help with SQL
          Level 7
          Unions should work. Make sure that the field names and data types match
          between tables, otherwise you may have to do some creative SQL to add
          emtpy fields to some tables and modify data types for others.


          proxim00 wrote:
          > Hi everyone, I have been trying to figure this out all day and nothing seems to
          > work. So this is the situation, I have a site that will have multiple tables
          > for each product category, this was done because I am useing a script to upload
          > xls docs and insert them into the DB, anyhow I want to creat a search for the
          > site. My problem is how would I be able to search all the tables and return the
          > results?
          >
          > So I have table1 - 5 right each one needs to be searched for keyword of say
          > "gem stone" and then return the results Im assuming with one query. I have
          > tried to do Full join, Unions etc but none of them seem to work right. I had
          > some success with Full Join but when I tried to add in additional tables it
          > crapped out on me. I don't need a where clase just need to grab the records in
          > a view them query it from the code. I guess my real question is what should I
          > use to do this?
          >
          > Once I know what way to approch it I think I should be fine but for the life
          > of me I cant get it working
          >
          > Thanks for any help you all can give
          >
          >
          • 2. Re: Help with SQL
            proxim00 Level 1
            Thanks Carl! I created a I used UNION ALL and it worked like a charm :) funny how sometimes you need to take a step back ask a question and then what do you know it works lol

            Thanks again.