Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

important LIKE question

Status
Not open for further replies.

alseczg

Programmer
Dec 26, 2006
3
HU
Hi all!

I have a serious problem for me! I hope some of U know the answer.
I have a table. in my table there are columns. One of my important colums hold a text..the datas in it looks like here:
1. row
False,True,False,False,False,False,True,False,False,False,False,True,False,
False,True,False,True,False,True,True,True,False,True,True,False,True,
False,False,False,False,True,False,False,False,False,False,False,False,
False,False,False,False,False,False,True,True,False,

2. row
apar_properties
False,False,True,False,False,False,False,True,False,False,False,True,False,
False,True,False,False,True,True,True,True,False,False,False,True,False,
True,False,False,False,True,True,False,False,False,True,True,False,True,
True,False,False,False,False,False,False,True,

etc. As U can see, there are diffenrences in it because the different properties.. I have to write a Query! The query have to return with the IDs (not this is the problem).
QUESTION: in some cases the first 10 true/false not important for me (anything have to be true or false, not important). So in this cases I need a Query like this (but this not working): '%,%,%,%,%,%,%,%,%,%,True,False,True,etc,..This SELECT have to return the IDs where the first ten true/false may have anything and from the 11th I have to tell exactly what I need.

I hope U can understand my bla..
Many thx!
 
Your first and biggest problem is the lack of normalization. Secondly, using proper terminology (and a more professional presentation of your spelling and grammatical skills) when referring to your issues will help us tremendously when trying to assist you.

So, to address your first problem, you should read the fundamentals document linked below. If at this point it is not feasible to correct your table structure, search the fora for 'UNION' and 'normalize'.

Secondly, tables have fields (not columns) and records (not rows).

To address the question posted, if it doesn't matter what is in the first ten fields, why are you including that in your criteria?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases:
The Fundamentals of Relational Database Design
Understanding SQL Joi
 
Leslie said:
Secondly, tables have fields (not columns) and records (not rows).
For me, all RDBMS (but those of MS) handle columns in rows in tables in databases ...;-)
 
BTW, forgot to reply to the OP !
alseczg, in JetSQL the wild char for the LIKE operator is * (not %).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Dear Lespaul!

Thanks for the lesson, but I have not the problem with the normalization. I could do the job with normalized table, but this is a much simpler solution for me. Sorry for the columns and rows words..
The UNION is not the answer to my question and:

if it doesn't matter what is in the first ten fields, why are you including that in your criteria?

in some cases the first ten "fields", words in the field is very important for me, so I have to include and store them! But in other cases not important so can be anything (true/false) but i need to store them!

thx and waiting for Ur answer for to my LIKE (or something else) question.
 
The % is working but the * is not (access).

SELECT apar_ID,apar_properties FROM tblApartmanok WHERE apar_properties like 'False,True,%' - this return with the rows where the first two word is false,true and the others is not important, but the following:
SELECT apar_ID,apar_properties FROM tblApartmanok WHERE apar_properties like '%,False,True' NO GOOD. This gives back all the rows...but it seems to be normal..
BUT what may have the answer?

thx
 
fine, be that way! I will personally cringe every time I see "rows" and "columns" and keep my mouth shut since I seem to be outvoted!! [hairpull]

les
 
And the pedantic version of:
columns in rows in tables
is:
attributes in tuples in relations
[/pedantic]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top