i need to connect 2 different columns from 2 tables.
note the these columns are strings (varchar)
column on 1st table: description1
column on 2nd table: description2
example:
description1: corporate unit staff
description2: corporate unit staff/division head/finance
i did some string manipulation.
variable.ToString.Substring(0, (DataTable.Rows(0)("description2")).ToString.Index Of("/"))
how do i connect these tables using inner join in sql or code behind?
9 2225
i need to connect 2 different columns from 2 tables.
note the these columns are strings (varchar)
column on 1st table: description1
column on 2nd table: description2
example:
description1: corporate unit staff
description2: corporate unit staff/division head/finance
i did some string manipulation.
variable.ToString.Substring(0, (DataTable.Rows(0)("description2")).ToString.Index Of("/"))
how do i connect these tables using inner join in sql or code behind?
Dont you want to join these two tables on any primary key??
if not then simply use the UNION operator....like SELECT description1 FROM table1 UNION SELECT description2 FROM table2
Note: This command cannot be used to list all descrition in table1 and table2. If there is description with the same name then only one will be listed . The UNION command only selects distinct values.
If you want all values then use UNION ALL operator like..... SELECT description1 FROM table1 UNION ALL SELECT description2 FROM table2
is this the answer you want??? let us know.
Dont you want to join these two tables on any primary key??
if not then simply use the UNION operator....like SELECT description1 FROM table1 UNION SELECT description2 FROM table2
Note: This command cannot be used to list all descrition in table1 and table2. If there is description with the same name then only one will be listed. The UNION command only selects distinct values.
If you want all values then use UNION ALL operator like..... SELECT description1 FROM table1 UNION ALL SELECT description2 FROM table2
is this the answer you want??? let us know.
not exactly the answer im looking for.
my main concern is AFTER the string manipulation. i couldnt join the two tables because they give different values like ive mentioned earlier. so i need to do string manipulation first for Description2 to connect them
not exactly the answer im looking for.
my main concern is AFTER the string manipulation. i couldnt join the two tables because they give different values like ive mentioned earlier. so i need to do string manipulation first for Description2 to connect them
On what basis do you want to connect the 2 tables?
not exactly the answer im looking for.
my main concern is AFTER the string manipulation. i couldnt join the two tables because they give different values like ive mentioned earlier. so i need to do string manipulation first for Description2 to connect them
what type of string manipulation you want......be more specific.......give some example if possible....
what type of string manipulation you want......be more specific.......give some example if possible....
1st table has column1 that contains a value, Corporate
2nd table has column2 that contains a value, Corporate/staff/unit -
pac2 = pac.ToString.Substring(0, pac.ToString.IndexOf("/"))
-
after the manipulation of the string in column2, it results to "Corporate" which is the basis for the connection of the two tables.
how do i connect these two tables using sql or code behind. also, i have 3 more tables to connect with. so the use of inner join is, i think, imperative.
On what basis do you want to connect the 2 tables?
the string. the other table doesnt have a primary. so i have to base on the string (varchar) instead. which the columns of these 2 tables are different. i only need the string before the slash ("/") to connect these
the string. the other table doesnt have a primary. so i have to base on the string (varchar) instead. which the columns of these 2 tables are different. i only need the string before the slash ("/") to connect these
Still not sure what you are looking for!
any examples?
from what i can figure out, you want to output 2 columns, and show the columns from the second table whose field starts with the string of field of the first table. - select t1.c1, t2.c1 from table1 t1, table2 t2
-
where t1.c1 like concat('%',t1.c1,'%')
Still not sure what you are looking for!
any examples?
from what i can figure out, you want to output 2 columns, and show the columns from the second table whose field starts with the string of field of the first table. - select t1.c1, t2.c1 from table1 t1, table2 t2
-
where t1.c1 like concat('%',t1.c1,'%')
i tried the code u gave me. there was an error.
i want to connet these 2 tables based on a string data type.
column1 in table1 = corporate
column2 in table2 = corporate/staff/unit
i did a string manipulation in column2. so it becomes "corporate". this is for the connection of table1 to table2. the problem is, how do i join them with the other 3 tables. will i use inner join or just code it in code behind?
i tried the code u gave me. there was an error.
i want to connet these 2 tables based on a string data type.
column1 in table1 = corporate
column2 in table2 = corporate/staff/unit
i did a string manipulation in column2. so it becomes "corporate". this is for the connection of table1 to table2. the problem is, how do i join them with the other 3 tables. will i use inner join or just code it in code behind?
still very confusing...why dont you use three different fields for corporate,staff and unit in the second table....???
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Wonderinguy |
last post by:
Our websphere application uses a generic application userid to connect
and query db2 on z/os via DB2 connect. The end user,logs in to the
application using
his regular userid, which is then...
|
by: Wilfried |
last post by:
Hi,
I have 5 tables:
main
data1
|
by: Luis Esteban Valencia |
last post by:
I have this
i need to show the datagrid with columns of 2 datatables
Dim myadap As New SqlDataAdapter
myconn.Open()
myadap.TableMappings().Add("Table", "vistaUsuarios")
|
by: sal |
last post by:
Greets, all
I'm trying to create different multiple mailing type labels on a page
reading from an untyped dataset anyone have any ideas on how I can get
this done without crystal reports a plan...
|
by: serge |
last post by:
/*
Subject: How to build a procedure that returns different
numbers of columns as a result based on a parameter.
You can copy/paste this whole post in SQL Query Analyzer
or Management Studio...
|
by: explode |
last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As
String) that creates a new oledbDataAdapter with insert update select and
delete commads. I also added that commands can...
|
by: Jim |
last post by:
Hello everyone,
This is my first time posting to a Usenet group, so please excuse any
Netiquette errors I may have in my post. I have used ASP.NET before
using C#, but never VB, so I'm trying...
|
by: cberthu |
last post by:
Hi all,
Is it possible to have two connects in the same rexx script to
different DB's?
I have to get data form on DB (with specifics selects and filter out
some values with RExx) and save the...
|
by: Al G |
last post by:
Can someone tell me what I need to get connected to our AS400?
I am trying to write an app in VS2005(Data source, Gridview) that requires
data from files on our AS400. I've downloaded DB2, and...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |