Click here to Skip to main content
11,410,118 members (61,307 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C C# ASP HTML ASP:NET
i have two tables tableA tableB
in tableA i have

ID (int)
Name
active


in tableB i have (ID foriegn key)

ID (int)
Bid (int)
Addree

my question is i have to get all values from tableB
in which i have only value in hand is "active"

in tableA
active field values are 1
ID values are different say 1,2,3,4,5

in tableB
ID vales are 1,2,3,4,5
Bid values are 6,7,8,9


i have to get all values (Addree from tableB) using active
how can i pass these values to array to get the values of tableB
Posted 13-Dec-12 18:58pm
Comments
sreeCoderMan at 14-Dec-12 0:18am
   
yes you can see ID in both tables

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you can use simple SQL Join queries to retrieve the data from the database and fill your array.

select * from tableB B right join tableA A on B.Id = A.Id where A.active = 1

more example on SQL Join Queries
http://stackoverflow.com/questions/1069205/left-and-right-joining-in-a-query[^]
http://www.tizag.com/sqlTutorial/sqljoin.php[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 169
1 OriginalGriff 110
2 Maciej Los 68
3 BillWoodruff 60
4 Philippe Mori 60
0 Sergey Alexandrovich Kryukov 8,755
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web01 | 2.8.150414.5 | Last Updated 14 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100