SELECT from several columns

Results 1 to 2 of 2

Thread: SELECT from several columns

  1. #1
    Join Date
    Dec 1969

    Default SELECT from several columns

    Is this the correct syntax for selecting from several columns ?<BR>I just can&#039t get it right.<BR><BR>SQL = "SELECT * FROM col1 OR col2 LIKE &#039%" & strCriteria & "%&#039"<BR><BR>Thanks for any help!<BR><BR>Espen

  2. #2 Guest

    Default RE: SELECT from several columns

    I don&#039t believe that is correct.. But you can select fields from several columns.. you&#039ll want to probably stick the table name before it using the dot operator (i.e. tablename.columnname) .. You want * so I suppose that isn&#039t an issue, but I believe selecting from multiple tables is as easy as using the comma delimiter .. so you should be able to do, for example : "SELECT * FROM Table1, Table2 WHERE Table1.Name = Table2.Name" .. Again, you want to use the dot operator and specify the table when referring to specific fields.. <BR>I do know that you can use INNER JOIN in your FROM clause to combine records from tables but you need to have a matching item in both tables.. so if i have a table called Members and in there i have MemberID, Name, Phone and I have a table called Dues and in it I have MemberID, DuesOwed, DuesPaid .. You can use the INNER JOIN operation to pull the information in both tables, such as: "SELECT Member.Name, Dues.DuesOwed FROM Members INNER JOIN Dues ON Member.MemberID = Dues.MemberID;"<BR><BR>Hope this is some help ..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts