Click here to Skip to main content
15,911,711 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two tables DataCard_Master with fields

DataCard_Name

DataCard_No (PK)

Model

Reporting Manager

IssuedOn

and another table is Team_master with fields

ID (PK)

Team Name (Its a DropDown containing values, so i made it as separate table )

I have to generate the report with all the five fields of Datacard_Master and (Team Name) of Team_Master which i select from drop down for respective DataCard_No .
Posted
Comments
Mehdi Gholam 24-Sep-13 12:23pm    
... and you expect us to help you how?
Ankit Mishra 24-Sep-13 12:30pm    
Sir I am new SQL server i am trying but i am getting all the values from Team_master for single field for DataCard_master.
Mehdi Gholam 24-Sep-13 12:35pm    
First contact your db admin and ask him/her how to relate those two tables.
mgoad99 24-Sep-13 12:37pm    
Isn't DataCard_No the related field that is in each table?
Love 2 code 24-Sep-13 12:46pm    
I suggest adding a column team_master_id to the table DataCard_Master and fill that column with the chosen id from Team_master. There you have your connection.
Peace!

Basically, you have to think of this from a logical point of view: What connects the two tables?
Think of it this way: you can have a shopping list that contains all the items you need to buy for supper tonight, and a ToDo list that contains all the tasks you need to complete - including going shopping and cooking the supper - but unless each row in the ToDo list is related to a single item in the shopping list, they are not related, so you can't get "A ToDo with it's shopping item".

You have two tables, and the only vague connection I can see is that the ReportingManager could be a TeamMaster in which case you can indeed select the date how you want:
SQL
SELECT d.DataCard_Name, d.DataCard_No, d.Model, t.TeamName, d.IssuedOn FROM DataCard_Master d
JOIN Team_master t ON t.ID=d.ReportingManager


If that isn't a valid connection, then you need to establish such a connection first - or you can't logically retrieve any related data.
 
Share this answer
 
in The concepts of database
When we have tables with no common attributes ,
we have to use Cross join .
in Cross join Each Row See all other rows
So you have a chance to compare all the rows together
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900