473,396 Members | 1,784 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,396 software developers and data experts.

Records combination

1
I have a database table tblobjects like this:

object_name, reference_id

a 1
a 2
a 3
a 4

b 2
b 3
b 1
b 4

c 2
c 4
c 5
c 6

d 2
d 4
d 5
d 6


I now would like to have a SQL query which gives me the number of
unique object and reference combinations, like this:

a
b
c

d shouldn't be displayed, because it's equal to c. The problem is also that a sequence of object references is
also important. So, for instance, object a shouldn't be equal to object b. The solution should also work is MS SQL and Mysql.

Any ideas how can I do this?

Thanks!
Dec 18 '06 #1
1 1216
b1randon
171 Expert 100+
I have a database table tblobjects like this:

object_name, reference_id

a 1
a 2
a 3
a 4

b 2
b 3
b 1
b 4

c 2
c 4
c 5
c 6

d 2
d 4
d 5
d 6


I now would like to have a SQL query which gives me the number of
unique object and reference combinations, like this:

a
b
c

d shouldn't be displayed, because it's equal to c. The problem is also that a sequence of object references is
also important. So, for instance, object a shouldn't be equal to object b. The solution should also work is MS SQL and Mysql.

Any ideas how can I do this?

Thanks!
You need to work on the structure of the data. The way you have it now won't suit the functionality you want. You should think about maybe adding a sequence column (otherwise you could do an "ORDER BY" and screw up your data). The sequence column would also help when you go to compare your objects. You're going to want to do a stored procedure with this too, rather than trying to issue a sql stmt, which probably wouldn't be possible anyway.
Dec 20 '06 #2

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

Similar topics

3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
9
by: Catherine Jo Morgan | last post by:
Can I set it up so that a certain combination of fields can't contain the same entries, on another record? e.g. a combination of FirstName/LastName/address? Or FirstName/LastName/phone? Or...
1
by: PMBragg | last post by:
ORINGINAL Post >Thank you in advance. I'm trying to pull all inventory items from December >of the previous year back to 4 years for my accountant. I know this can be >done, but I'm drawing a...
0
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary...
7
by: Paul T. Rong | last post by:
Hi everybody, I can not add into the "order_detail" subform a product more than once. The subform just refuses accepting any repeated items. The subform's source is a "expanded_order_detail"...
4
by: KT | last post by:
Is there any one click solution that would do the trick? I would like to create a button, so the person who maintains the database can perform clean up work to delete duplicate records which...
15
by: Hi5 | last post by:
Hi, I am designing a database for a client in which It has a client table including the followings: 1-Table Client 2-Table lookupcategory 3-Table Ctegory
4
by: ssrirao | last post by:
Table1 -------------------------------------------------------- a(varchar) | b(varchar) | c(varchar) | d(float) --------------------------------------------------------- has value...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
3
by: BASSPU03 | last post by:
I had to present my DB today, but was granted a chance to fix something about it. In order to fix something, I added something...something that is giving me more trouble than it should. I have to...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.