473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sorting One table based on its correlation to another

ChaseCox
294 100+
I have two tables, one is my main table(main), containing all of the information about the product, including the 3 digit code in question. The other table (small) contains only one column of the 3 digit codes in question. The "small" table is built on the fly so that it contains unique 3 digit numbers in one column. When the query is run, I would like to only show all of the records from the "main" table that match one of the 3 digit numbers from the "small" column. For example if In my small column, I had the following:
150
151
180
Then when my query ran, I would like to only have those records show up, like:
150
150
150
151
151
180
151
150
180
180
180
I hope this is clear enough. THANKS.
Mar 5 '07 #1
3 1402
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM main INNER JOIN small ON main.code = small.code;
I have two tables, one is my main table(main), containing all of the information about the product, including the 3 digit code in question. The other table (small) contains only one column of the 3 digit codes in question. The "small" table is built on the fly so that it contains unique 3 digit numbers in one column. When the query is run, I would like to only show all of the records from the "main" table that match one of the 3 digit numbers from the "small" column. For example if In my small column, I had the following:
150
151
180
Then when my query ran, I would like to only have those records show up, like:
150
150
150
151
151
180
151
150
180
180
180
I hope this is clear enough. THANKS.
Mar 5 '07 #2
ChaseCox
294 100+
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM main INNER JOIN small ON main.code = small.code;
Thanks that helped! GOT IT.
Mar 6 '07 #3
Rabbit
12,516 Expert Mod 8TB
Not a problem, glad I could help.
Mar 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: John | last post by:
Hi all, I am doing the change from having worked in Oracle for a long time to MS SQL server and am frustrated with a couple of simple SQL stmt's. Or at least they have always been easy. The...
3
by: Paul Fairless | last post by:
Customers table - contains Columns: CustID, Surname, Forename, TtlID Titles table - contains Columns: TtlID, Title TtlID is a Foreign Key in the Customers table. I have a Form frmCustomers...
17
by: Matt Kruse | last post by:
I'm looking for the best JS/CSS solution to add functionality to tables. The only browser which needs to be supported is IE5.5+, but no activeX can be used. to be able to do: - Fixed header row...
7
by: robert | last post by:
i need to update a column which is a member of the PK on this table. there are some thousands of rows to be updated, many more thousand already in the table. so, i get a constraint violation...
8
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
2
by: jab3 | last post by:
Hello - I'm trying to implement a table that will allow the user to sort on each column, like many applicaitons that have tabular data (e-mail, song list, etc). It invovles grabbing the table,...
1
by: jjjoic | last post by:
Hi, I use Access 2003 to generate the back-end data for a ColdFusion report at work. The report is sorted by a column and based on the sorting, rankings are assigned to each row(i.e. the biggest...
0
by: acesfull | last post by:
Hi, I am trying to do something in SQL that I have done in PHP, but I am trying to have the operation performed as a stored procedure because of the sheer number of inserts I have to perform in PHP. ...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
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...
0
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
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.