Hello there,
I am new in using SQL 2000. Please help me to find out how to create a select query or function to return the expected result below. Table 1: User_Table
UserID | xName | xCode
---------------------------------------------
1 | XYZ | SG3,SG9
2 | ABC | KR12,KR13 Table 2: Outlet_Table
Outlet_ID | xCode
-------------------------------------------------------
987654 | KR12
77777 | SG9
Create a query that will display the expected result below:
Outlet_ID | xCode | UserID
----------------------------------------------------------------
987654 | KR12 | 2
77777 | SG9 | 1
Please help.
Kindest regard,
jen
6 1761
Hello there,
I am new in using SQL 2000. I need to find out how to create a select query or function from the below.
Table 1: User_Table
UserID xName xCode
------------------------------------------------
1 XYZ SG3,SG9
2 ABC KR12,KR13
Table 2: Outlet_Table
Outlet_ID xCode
---------------------------------
987654 KR12
77777 SG9
Create a query that will display the expected result below:
Outlet_ID xCode UserID
----------------------------------------------------------------
987654 KR12 2
77777 SG9 1
Please help.
Kindest regard,
jen
Try this query: -
-
SELECT ot.outlet_id,ot.xcode,ut.user_id FROM
-
outlet_table ot, user_table ut
-
WHERE ut.xcode LIKE '%ot.xcode%'
-
-
Try this query: -
-
SELECT ot.outlet_id,ot.xcode,ut.user_id FROM
-
outlet_table ot, user_table ut
-
WHERE ut.xcode LIKE '%ot.xcode%'
-
-
Thank you for a very quick reply.
Using Line 3. WHERE ut.xcode LIKE '%ot.xcode%' did not return any result.
I tried to add a bracket WHERE ut.xcode LIKE '% [ot.xcode ]%' but the result ID is not correct. :(
Hello there,
I am new in using SQL 2000. Please help me to find out how to create a select query or function to return the expected result below. Table 1: User_Table UserID | xName | xCode
--------------------------------------------- 1 | XYZ | SG3,SG9 2 | ABC | KR12,KR13 Table 2: Outlet_Table Outlet_ID | xCode
------------------------------------------------------- 987654 | KR12 77777 | SG9
Create a query that will display the expected result below: Outlet_ID | xCode | UserID---------------------------------------------------------------- 987654 | KR12 | 2 77777 | SG9 | 1
Please help.
Kindest regard,
jen
Hello,
Please help me solve this comma delimited case.. the table i am querying has no primary key or even common field except for the Outlet_Table.xCode and Outlet_ID.xCode.
Regards,
Jen
Hello,
Please help me solve this comma delimited case.. the table i am querying has no primary key or even common field except for the Outlet_Table.xCode and Outlet_ID.xCode.
Regards,
Jen
Try this: -
-
SQL> SELECT outlet_table.oid, user_table.id, outlet_table.xc,user_table.xc FROM
-
2 (select 1 AS id, 'XYZ' AS xname, 'SG3,SG9' AS xc FROM DUAL) user_table,
-
3 (SELECT 999999 AS oid, 'SG9' AS xc FROM DUAL) outlet_table
-
4 WHERE INSTR(user_table.xc,outlet_table.xc) > 0
-
5 /
-
-
OID ID XC XC
-
--------- --------- --- -------
-
999999 1 SG9 SG3,SG9
-
-
SQL>
-
-
Try this: -
-
SQL> SELECT outlet_table.oid, user_table.id, outlet_table.xc,user_table.xc FROM
-
2 (select 1 AS id, 'XYZ' AS xname, 'SG3,SG9' AS xc FROM DUAL) user_table,
-
3 (SELECT 999999 AS oid, 'SG9' AS xc FROM DUAL) outlet_table
-
4 WHERE INSTR(user_table.xc,outlet_table.xc) > 0
-
5 /
-
-
OID ID XC XC
-
--------- --------- --- -------
-
999999 1 SG9 SG3,SG9
-
-
SQL>
-
-
this is great! thank you it worked! =)
this is great! thank you it worked! =)
You are welcome :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Arne |
last post by:
From: "Arne de Booij" <a_de_booij@hotmail.com>
Subject: Comma delimited array into DB problems
Date: 9. februar 2004 10:39
Hi,
I have an asp page that takes input from a form on the previous...
|
by: Christine Forber |
last post by:
I wonder if anyone knows of some javascript code to check a
comma-delimited list of email addresses for basic formating.
What I'm looking for is the javascript code to check a form field on
form...
|
by: Elmo Watson |
last post by:
I've been asked to develop a semi-automated type situation where we have a
database table (sql server) and periodically, there will be a comma
delimited file from which we need to import the data,...
|
by: A E |
last post by:
Hi,
I was wondering if there was a function that handles list elements of a comma delimited list? I need to be able to pass values as a comma delimited list, count the number of values, and...
|
by: Larry Williams |
last post by:
Is there an easy way to convert a string of data to XML format without having
to create the xml one field at a time?
Sorry I'm a newbie and my xml knowledge is limited. I have tried to search...
|
by: John B. Lorenz |
last post by:
I'm attempting to write an input routine that reads from a comma delimited
file. I need to read in one record at a time, assign each field to a field
array and then continue with my normal...
|
by: Wayne |
last post by:
I have the following string:
"smith", "Joe", "West Palm Beach, Fl."
I need to split this string based on the commas, but as you see the city
state contains a comma. String.split will spilt the...
|
by: Bernie Yaeger |
last post by:
Is there a way to convert or copy a .xml file to a comma delimited text file
using vb .net?
Thanks for any help.
Bernie Yaeger
|
by: JustSomeGuy |
last post by:
Hi. I have a comma delimited text file that I want to parse.
I was going to use fscanf from the C library but as my app is written
in C++
I thought I'd use the std io stream library...
My Text...
|
by: Ron |
last post by:
so if my textbox is named textbox1 and my listbox is named
ltsdisplay, for the button that would make this all happen I would
just need to:
...
|
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: 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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |