By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

Left join

P: n/a
Hi, all,

I tried to use "left join" to select data from my
database. Result is come out, but I didn't see the
value of "displayString". I added "left outer join",
same result.

SELECT devices.ProductType, devices.deviceKey,
devices.fullDNSName, deviceTypesEnum.displayString,
deviceTypesEnum.enumId FROM devices
LEFT JOIN deviceTypesEnum ON deviceTypesEnum.enumId
= devices.productType;
Can anyone tell me how to modify this query?

Thanks a lot!

Zengfa

[root@scmlin46 data]# psql -Umxadmin mydb_v1_0;
Welcome to psql 7.3.2, the PostgreSQL interactive
terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

mydb=# SELECT devices.ProductType,
devices.deviceKey, devices.fullDNSName,
deviceTypesEnum.displayString, deviceTypesEnum.enumId
FROM devices
mysql=# LEFT JOIN deviceTypesEnum ON
deviceTypesEnum.enumId = devices.productType;
producttype | devicekey | fulldnsname |
displaystring | enumid
-------------+-----------+--------------------+---------------+--------
0 | 1 | scmlin46 | |
(1 row)

mydb=#
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> I tried to use "left join" to select data from my
database. Result is come out, but I didn't see the
value of "displayString". I added "left outer join",
same result.
sounds like deeviceTypesEnum.enumID don't correspond to
devices.productType.

Jo

SELECT devices.ProductType, devices.deviceKey,
devices.fullDNSName, deviceTypesEnum.displayString,
deviceTypesEnum.enumId FROM devices
LEFT JOIN deviceTypesEnum ON deviceTypesEnum.enumId
= devices.productType;
Can anyone tell me how to modify this query?

Thanks a lot!

Zengfa

[root@scmlin46 data]# psql -Umxadmin mydb_v1_0;
Welcome to psql 7.3.2, the PostgreSQL interactive
terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

mydb=# SELECT devices.ProductType,
devices.deviceKey, devices.fullDNSName,
deviceTypesEnum.displayString, deviceTypesEnum.enumId
FROM devices
mysql=# LEFT JOIN deviceTypesEnum ON
deviceTypesEnum.enumId = devices.productType;
producttype | devicekey | fulldnsname |
displaystring | enumid
-------------+-----------+--------------------+---------------+--------
0 | 1 | scmlin46 | |
(1 row)

mydb=#
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.