I have made a basic left join statement say "Select t.*, p.usenet_id
from usenet_group_1 u left join user_table t on u.id = t.usenet_id;
but only want the recordset to return values from user_table if field
in user_table have a certain value ( if usenet_group = 5 ) - can this
be done within the above sql statement or do i have to make 2 seperate
statements?
regards
Jakob ou****@HaHapost6.tele.dk
Cut out the laughing if replying to email address 2 5783
Well - found the answer myself - it was really to easy: Just need to
add the field, ie;
"Select t.*, p.usenet_id, p.usenet_group from usenet_group_1 u left
join user_table t on u.id = t.usenet_id and p.usenet_group = 5;
:- |
On Thu, 29 Dec 2005 07:17:08 GMT, ou****@HaHapost6.tele.dk (Jakob
Outzen) wrote: I have made a basic left join statement say "Select t.*, p.usenet_id from usenet_group_1 u left join user_table t on u.id = t.usenet_id; but only want the recordset to return values from user_table if field in user_table have a certain value ( if usenet_group = 5 ) - can this be done within the above sql statement or do i have to make 2 seperate statements?
regards Jakob ou****@HaHapost6.tele.dk Cut out the laughing if replying to email address ou****@HaHapost6.tele.dk
Cut out the laughing if replying to email address
"Jakob Outzen" <ou****@HaHapost6.tele.dk> wrote in message
news:43****************@news.inet.tele.dk... I have made a basic left join statement say "Select t.*, p.usenet_id from usenet_group_1 u left join user_table t on u.id = t.usenet_id; but only want the recordset to return values from user_table if field in user_table have a certain value ( if usenet_group = 5 )
Yep, you can specify conditions in the ON clause of an outer join.
Rows that don't match are not included in the join.
For example:
SELECT t.*, p.usenet_id
FROM usenet_group_1 u LEFT OUTER JOIN user_table t
ON (u.id = t.usenet_id AND t.usenet_group = 5)
Regards,
Bill K. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alex |
last post by:
Hi,
I'm trying to do calculations in a SQL statement, but depending on one
variable (a.type in example) I'll need to pull another variable from
seperate tables.
Here is my code thus far:
...
|
by: Ilik |
last post by:
Hi all
I'm trying to create a summery table of rain data that holds a record
for every 0.1mm of rain in the following format:
Station Name, Time, Value
A, 2002-12-03 14:44:41.000, 0.1
A,...
|
by: chandy |
last post by:
Hi,
I am trying to change an SP from dynamic SQL to proper SQL but I can't
figure a way to conditionally add extra parts to the statement. How
can I do the equivalent of the following?
...
|
by: Bob Stearns |
last post by:
As part of what I want in a report, I want the associated row from t2,
if there is one, with the largest date in a range based on the base row
from t1. I attempted the following:
left outer join...
|
by: Raghavendra R A V, CSS India |
last post by:
hie..
Do any one knows how to write a C program without using the
conditional statements if, for, while, do, switch, goto and even
condotional statements ? It would be a great help for me if...
|
by: Piper707 |
last post by:
Hi,
I need to know if there is any way of achieving conditional processing
for XSD elements.
---------------------------------------------------------------
<criteria></criteria> = a complex...
|
by: A.M |
last post by:
Hi,
I am using Python 2.4. I read the PEP 308 at:
http://www.python.org/dev/peps/pep-0308/
|
by: msrviking |
last post by:
Hello everybody,
After several attempts of writing the query, I had to post my
requirement in the forum.
Here is what I have, what I need and what I did.
Table A
Col1 Col2
1 Nm1
|
by: simon.harris |
last post by:
I have a query in an Access2000 db (created using the QBE as it
happens!) that the resulting SQL looks like this;
SELECT
CLIENTS.,
Logfile.,
Logfile.,
SASTESTS.Cost,
SASTESTS.*CLIENTS. AS...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |