473,396 Members | 1,834 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.

Something about Qualifiers?

blyxx86
256 100+
Good afternoon everyone...

I'm trying to remove unnecessary NULL values from within some of my tables.

Essentially I have this problem: An item can be assigned to a person/location/status. However, it is only in one of those places, never all three, and never a combination of them. I could define 3 columns person_id, location_id and status_id. Then generate 3 queries to find who/where/what that item is assigned to. ORRRR... Is it possible to put a qualifying column that would be an enum ("person", "location", "status") and the ID would go with the other part.

Any ideas on what I'm looking for? I'm kinda stumped.
May 6 '09 #1
4 1378
code green
1,726 Expert 1GB
What about a table
Expand|Select|Wrap|Line Numbers
  1. assign     code
  2. person       1
  3. location     2
  4. status       3
Then have TWO columns for assigning, which will never be NULL
That is an ID column which holds the person_id of location_id etc
and id_code linked to table above.

Or have I missed your point completely?
May 7 '09 #2
blyxx86
256 100+
No no. You hit my question right on the head.

You said, much more clearly, what my "ORRR" section was attempting to explain. How, then, would I write a query when each of those ids relate to a different table?
May 7 '09 #3
code green
1,726 Expert 1GB
Ouch. So the IDs are in different tables.
I think is what is referred to as a conditional JOIN.
I have had a similar problem. Can't remember if I solved it.

Try googling for conditional JOIN while I think about this.
May 8 '09 #4
blyxx86
256 100+
I found something regarding CASE statement and MySQL.

http://dev.mysql.com/doc/refman/5.0/...statement.html

SELECT (CASE field1 WHEN 'Yes' THEN 1 WHEN 'No' THEN 0 ELSE 0 END) FROM mytable;

I'm super tired (yet suffering from a slight case of insomnia). So I'm mostly posting this find as a note source for sometime tomorrow or over the weekend.
May 8 '09 #5

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

Similar topics

3
by: Tron Thomas | last post by:
Given the following code: #include <vector> #include <algorithm> #include <functional> class Value { public: explicit Value(int value) : m_value(value) {}
17
by: DanielESFA | last post by:
Hey guys :) This is a bit of a funny one... We're four guys working on the same project, everybody using KDevelop and g++ on Linux. Three of us are using Mandrake, with g++ 3.4.3 and 3.4.1....
12
by: Charlie Zender | last post by:
Hi, I am unable to compile a large body of code with extremely pedantic compile time checks activate, so that warnings cause errors. With GCC 3.3.1, I do this with gcc -std=c99 -pedantic...
60
by: Dominique Léger | last post by:
Hello guys, I'm kinda new to C, and I'm having a hard time with strings. What I'm trying to do is a simple function that trims spaces & tabs at the beginning of a given string. For example, I...
7
by: Lucas Tam | last post by:
Hi all, Does anyone know of a GOOD example on parsing text with text qualifiers? I am hoping to parse text with variable length delimiters/qualifiers. Also, qualified text could run onto...
2
by: John | last post by:
Hello! When I compile the following code, I get this error message "error: passing ... discards qualifiers" and I don't understand why. Could anybody help me? Thank you! John
0
by: jmarr02s | last post by:
I wish to supply text qualifiers to the following date time stamp function, Expr1: FormatDate(Now()) in my query, using fField1: Chr(34) & & Chr(34)...How must I write this? Next, I export the...
17
by: Pietro Cerutti | last post by:
i Group, to my understanding, defining a function parameter as "const" means that the function is not going to change it. Why does the compiler says "return discards qualifiers from pointer...
4
by: Andre | last post by:
Hi All, When I compile the following piece of code with gcc, I get 3 "warning: initialization discards qualifiers from pointer target type" messages which refer to the 3 lines marked in the...
1
by: sumsin | last post by:
Is there any difference between 'qualifiers and modifiers? Or both are synonyms, because in general they are used interchangeably. Which is the standard word from language perspective? What are...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
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...
0
agi2029
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,...

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.