I've a query with multiple link possibilities:
SELECT model1.Name as ModelName, model2.Name as ModelName, model3.Name as
ModelName, shmodel.shmodel name as ModelName, ...
If I then try to do a "order by ModelName", then the query fails (Unknown
column 'ModelName' in 'order clause'). Any idea ? 8 1831
*** Bob Bedford wrote/escribió (Tue, 8 Feb 2005 15:58:19 +0100): SELECT model1.Name as ModelName, model2.Name as ModelName
[...] If I then try to do a "order by ModelName", then the query fails (Unknown column 'ModelName' in 'order clause'). Any idea ?
Which ModelName column do you mean? You have two.
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
"Alvaro G Vicario" <al************ ******@telecomp uteronline.com> a écrit
dans le message de news: fw************* *************** *@40tude.net... *** Bob Bedford wrote/escribió (Tue, 8 Feb 2005 15:58:19 +0100): SELECT model1.Name as ModelName, model2.Name as ModelName [...] If I then try to do a "order by ModelName", then the query fails (Unknown column 'ModelName' in 'order clause'). Any idea ?
Which ModelName column do you mean? You have two.
I need one column only ! in some cases the ModelName comes from table
model1, sometimes from model2. It's there any way to create only one column
?
*** Bob Bedford wrote/escribió (Tue, 8 Feb 2005 16:50:33 +0100): Which ModelName column do you mean? You have two.
I need one column only ! in some cases the ModelName comes from table model1, sometimes from model2. It's there any way to create only one column ?
Try a join with the IFNULL() function:
IFNULL(expr1,ex pr2)
If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2.
IFNULL() returns a numeric or string value, depending on the context in
which it is used.
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
"Alvaro G Vicario" <al************ ******@telecomp uteronline.com> a écrit
dans le message de news: hx************* *************** @40tude.net... *** Bob Bedford wrote/escribió (Tue, 8 Feb 2005 16:50:33 +0100): Which ModelName column do you mean? You have two.
I need one column only ! in some cases the ModelName comes from table model1, sometimes from model2. It's there any way to create only one column ?
Try a join with the IFNULL() function:
IFNULL(expr1,ex pr2)
If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2. IFNULL() returns a numeric or string value, depending on the context in which it is used.
FANTASTIC !!!! thanks a lot !
Bob Bedford wrote: SELECT model1.Name as ModelName, model2.Name as ModelName If I then try to do a "order by ModelName", then the query fails (Unknown column 'ModelName' in 'order clause'). Any idea ? Which ModelName column do you mean? You have two.
I need one column only ! in some cases the ModelName comes from table model1, sometimes from model2.
Somehow, I have a feeling your data model needs revision...
It's there any way to create only one column?
If you need one column only, then you should define one column
only. Something like this:
SELECT CONCATENATE(mod el1.Name, model2.Name, model3.Name,
shmodel.shmodel name) as ModelName, ...
Cheers,
NC
>> I need one column only ! in some cases the ModelName comes from table model1, sometimes from model2.
Somehow, I have a feeling your data model needs revision...
Not so easy: let's explain. I've a database coming from a company. Some
datas aren't available in this DB, and I've to create some items myself. I
can't do it on the other company's DB as the record are dropped regularly
and filled with new datas (updates, new items, etc). So I need to have 2
tables, one with the company's datas, and one with mine. It's there any way to create only one column?
If you need one column only, then you should define one column only. Something like this:
SELECT CONCATENATE(mod el1.Name, model2.Name, model3.Name, shmodel.shmodel name) as ModelName, ...
Concatene seems to fail if any items is NULL.
Bob Bedford wrote: "Alvaro G Vicario" <al************ ******@telecomp uteronline.com> a écrit dans le message de news: hx************* *************** @40tude.net...
*** Bob Bedford wrote/escribió (Tue, 8 Feb 2005 16:50:33 +0100):
Which ModelName column do you mean? You have two.
I need one column only ! in some cases the ModelName comes from table model1, sometimes from model2. It's there any way to create only one column ?
Try a join with the IFNULL() function:
IFNULL(expr1,ex pr2)
If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2. IFNULL() returns a numeric or string value, depending on the context in which it is used.
FANTASTIC !!!! thanks a lot !
Even better, try the Coalesce(list) function.
Your SELECT then becomes:
SELECT COALESCE(model1 .Name, model2.Name, model3.Name, shmodel.shmodel name)
as ModelName, ...
Coalesce(list) takes the first non-NULL in the list.
CJP
--
Christopher J Pomasl Suse Linux 9.0
Senior Software Engineer Starband 360 4/68
Computer Associates SPEBSQSA, Lead/Bari, SOR
IBM Certified Specialist - DB2 UDB V6/V7 User
IBM Certified Solutions Expert - DB2 V7 Family Application Development
IBM Certified Solutions Expert - DB2 UDB Database Administration for OS/390
Always remember, you are unique...just like everyone else.
"pomasl<nos pam> @starband.net>" <"pomasl<nospam > a écrit dans le message de
news: 85************* *@fe25.usenetse rver.com... Bob Bedford wrote: "Alvaro G Vicario" <al************ ******@telecomp uteronline.com> a écrit dans le message de news: hx************* *************** @40tude.net...
*** Bob Bedford wrote/escribió (Tue, 8 Feb 2005 16:50:33 +0100):
> Which ModelName column do you mean? You have two.
I need one column only ! in some cases the ModelName comes from table model1, sometimes from model2. It's there any way to create only one column ?
Try a join with the IFNULL() function:
IFNULL(expr1,ex pr2)
If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2. IFNULL() returns a numeric or string value, depending on the context in which it is used.
FANTASTIC !!!! thanks a lot !
Even better, try the Coalesce(list) function. Your SELECT then becomes:
SELECT COALESCE(model1 .Name, model2.Name, model3.Name, shmodel.shmodel name) as ModelName, ...
Great ! thanks for info. Probably I'm not the only one to find this useful.
Cheers This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: user mysql |
last post by:
HELLO FRIENDS. HERE A FANTASTIC NEWS FOR MYSQL WINDOWS USER. READE
THIS.
The article is grab from www/internetnews/com/
DO YOU THINK THAT IS A GOOD NEWS ?
-----------------------------------------------------------------------------
Open source database server company MySQL's next production release of
its open source MySQL database server will be sporting a new Windows
installer, one partially built with an open source project courtesy...
|
by: George Augustino |
last post by:
REQUEST FOR DISCUSSION (RFD)
unmoderated group comp.databases.mysql
Newsgroup line:
comp.databases.mysql MySQL relational database system discussion group.
This is a formal Request For Discussion (RFD) for the creation of a
world-wide unmoderated Usenet newsgroup comp.databases.mysql.
This is not a Call for Votes (CFV); you cannot vote at this time.
Procedural details are below.
|
by: s a n j a y |
last post by:
Hi All,
I am want to upgrade MySQL from 4.0 to 4.1 on linux. The reason being the
subqueries.
Problem is
Failed dependencies:
libcrypto.so.0.9.6 is needed by MySQL-Max-4.1.0-0
libssl.so.0.9.6 is needed by MySQL-Max-4.1.0-0
|
by: blizeach |
last post by:
The problem is that when I installed Slackware I told it to install
MySQL. I thought it did so. I looked around and found in the
directory /etc/rc.d/ a file called rc.mysqld.new wich I read.
It said to make this file executable so that it would start the
daemon at system boot. I made it executable. Needless to say it didn't
work.
So I read a little further. The same files says
to build the grant tables by switching to the mysql
user with...
|
by: Mike Chirico |
last post by:
Interesting Things to Know about MySQL
Mike Chirico (mchirico@users.sourceforge.net)
Copyright (GPU Free Documentation License) 2004
Last Updated: Mon Jun 7 10:37:28 EDT 2004
The latest version of this document can be found at:
http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
| |
by: Saqib Ali |
last post by:
I have set up MySQL on my machine and can successfully use it.
However, I'm trying to set up TOra so that I can browse the databases
effectively. I'm having lots of trouble trying to get TOra to work
with MySQL.
Please take a look at the notes below and please let me know why I'm
having trouble and how to fix it.....
Thanks
-Saqib
|
by: Nick |
last post by:
hi, all
I have a red hat 9 and looks like it had mysql 3.2.54 installed before,
but, actually not, i can not find the install folder and I can not
uninstall it. So I am trying to install/upgrade to 4.1, but, still can
not get it work.
Here is what I did:
# rpm -Uvh
MySQL-server-standard-4.1.14-0.rhel4.i386.rpm
warning: MySQL-server-standard-4.1.14-0.rhel4.i386.rpm: V3 DSA
signature: NOKEY, key ID 5072e1f5
|
by: Richard Petty |
last post by:
Today I began preparations for upgrading MySQL. I downloaded the binary RPMs for
Red Hat Enterprise 4 (we're running CentOS, a clone) for MySQL 5.0.13 from the
MySQL AB web site. Running a test, I got this:
rpm -hUv MySQL* --test
warning: MySQL-client-standard-5.0.13-0.rhel4.i386.rpm: V3 DSA signature: NOKEY,
key ID 5072e1f5
error: Failed dependencies:
libmysqlclient.so.14 is needed by (installed) mod_auth_mysql-2.6.1-2.2.i386...
|
by: Good Man |
last post by:
Hi there
I've noticed some very weird things happening with my current MySQL setup
on my XP Laptop, a development machine.
For a while, I have been trying to get the MySQL cache to work. Despite
entering the required lines to "my.ini" (the new my.cnf) through notepad
AND MySQL Administrator, the cache does not work.
So, today I took a peek at the 'Health' tab in MySQL Administrator.
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to
communicate with a MySQL database table on a web server, from inside
of my company's Access-VBA application. I know VBA pretty well but
have never before needed to do this HTTP/XML/MySQL type functions.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |