Hi.
i have table like this:
create table my_data (
cond_1 int8,cond_2 varchar(),cond_ 3 .... cond_n whatrver ,data text)
This table represents a simple tree structure with known max level (n) .
This table is filled with data, but branches have not a same depth.
Now I need to select from table
select data from my_data where cond_1=x AND cond_2='blah' And cond_3= .....
AND cond_n=whatewer
But, this tree have not a same depth in all his branches. So I need to
select Exact match, and, if the exact match is not possible (ie if there is
not line that fit WHERE condition ),
to select with WHERE cond_1=x AND cond_2='blah' And cond_3= ..... AND
cond_(n-1)=whatewer and so on until the 'data' is not empty or top of the
tree reached (ie if not match, find data from upper node of the tree).
I know, that similar effects can be reached with COALESCE,
select coalesce ((select data from my_data where cond_1=x AND cond_2='blah'
And cond_3= ..... AND cond_n=whatewer ),(select data from my_data where
cond_1=x AND cond_2='blah' And cond_3= ..... AND cond_(n-1)=whatewer)
,...........,(s elect data from my_data where cond_1=x ))
but i think it is not ideal, because it needs to perform a N subselects,
what can eat a lot of machine time...
is there some other way to do exact or less specific match ?
Thank you. please execuse my bad english
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend 0 1989 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark Findlay |
last post by:
I am trying to figure out how to set up my reg exp search so that the search
will only match on the exact word.
Here is the current problem code:
Word1 = "RealPlayer.exe"
Word2 = "Player.exe"
RegExp re = Word2;
if (re.Find(Word1))
|
by: Andy |
last post by:
Hi...
i'm trying to understand the concept of function name overloading in
c++.
to understand the resolving system it's important to understand the
diffrent
levels of typecasting (exact match, promotion, conversion, not
possible)
that is, what i don't really understand. so i tried do make a little
|
by: Doug |
last post by:
I am exectuing a query (against an Access database) and the results
are not an exact match of the search criteria.
I have a list of packages saved in an Access file. Before doing
certain operations, I want to see if a tracking number has already
been saved to file.
The tracking number "1234567890" is already stored in the file.
The tracking number "12345678901" is NOT in the file.
|
by: YS Sze |
last post by:
If you know the exact longitude and latitude for a specific
location, would anyone think it'd make any sense to find out if this
set of location numbers is really part of the Fibonacci series or not?
Or, another way to look at this is that: Would anyone of you think it
is worth a while to find out if there is any location on earth with
the set of longitude and latitude numbers that coincides with the
Fibonacci series?
As I see it, if...
|
by: Jon Lapham |
last post by:
I have a table that stores TEXT information. I need query this table to
find *exact* matches to the TEXT... no regular expressions, no LIKE
queries, etc. The TEXT could be from 1 to 10000+ characters in length,
quite variable. If it matters, the TEXT may contain UNICODE characters...
Example:
CREATE TABLE a (id SERIAL, thetext TEXT);
SELECT id FROM a WHERE thetext='Some other text';
One way I thought to optimize this process would...
| |
by: baka |
last post by:
Dear Sir/madam
Here i am having some one sql which returns more rows than the required
rows after comaparing tables
simple sql statement will be lokk like
SELECT t.empcd, s.daicd, s.chucd, s.shocd, t.juncd, s.shoname
FROM temptbl AS t,shomast AS s
WHERE t.shoname=s.shoname;
|
by: jmdaviault |
last post by:
I want to do the equivalent of
SELECT id from TABLE WHERE text='text'
only fast solution I found is:
SELECT id,text from TABLE WHERE MATCH(text) AGAINST('value' IN BOOLEAN
MODE) HAVING text='value'
|
by: Wayne Shu |
last post by:
Hi everyone.
In the following program, foo is an ambiguous call.
#include <iostream>
using namespace std;
void foo(int *);
void foo(int (&));
|
by: Rilly |
last post by:
Anyone use PowerMovielist here? I have the 0.14 beta version.
Do you have a problem where some shows you search for cause the fetch to hang ? I'm pulling my hair out on this..
For example, I search for Funky, and it comes up with all the hits.. I search for Funky Phantom, and it hangs for whatever
amount of seconds i have the script maximum execution time set to, then i get this error Fatal error: Maximum execution
time of 30 seconds...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |