Solved

VB.net SQL See all in one table

Posted on 2014-09-26
3
181 Views
Last Modified: 2014-09-26
I am building the following SQL statement to see everything in my BANK table that has the same [LINK ID] as
my Payments table and everything in my Payments table (Linked and not linked). I am not seeing some items
in my Payments table. Shouldn't I see everything from that side


            Dim sSQL As String
            sSQL = "Select Bank.*, Payments.*"
            sSQL = sSQL & " From Bank Right Join Payments on Bank.[LINK ID] = Payments.[LINK ID]"
0
Comment
Question by:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40345637
Select Bank.*, Payments.*"

will/would very likely result in "duplicate" column names in the result
as consequence, some db drivers will either
* raise an error
* rename the columns,
* skip the columns
* fill the columns with the same data as previous column

the only way to solve this out is to write a SQL that avoids duplicate column names, hence not using table.* in your select
the "workaround" I usually use is that I do this inside a view on the database side, and the application then does the select * from view_name, this way I could add new columns to the tables/views without breaking the application code and without having to deploy a new exe ...
0
 
LVL 3

Expert Comment

by:PrisonBroken
ID: 40345671
I always work with a left join but yes that looks like it should work.

Which specific rows are not showing up, is there a commonality in those that might help figure out why they are not returned?
0
 

Author Closing Comment

by:murbro
ID: 40345681
Thanks
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have a large data set and a SSIS package. How can I load this file in multi threading?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question