0

I’m having some trouble and can’t seem to find the solution. Hopefully someone here can help me out.

I have two tables in a SQL Database and I’m trying to select some information from both tables where the column‘UniqueID’ has the same value.


Here is the information I require from the Tables:

Table Name:
Featured

Column Names:
UniqueID (value for both tables)
Approve
Date_Activation

Table Name:
Information

Column Names:
UniqueID (value for both tables)
Headline
Description
Ref_No
Rowguid

I found some information that said I could create a WHERE statement like the following:

where Table1.ColumnName = Table2.ColumnmName

I have tried this and it’s not working. Here’s my code:

select 
UniqueID as UniqueID,
Headline as Headline,
Description as Description, 

case when Approve = '1' then 'True' when Approve is null then 'False' else 'False' end as Approve,
Ref_No as RefNo,
Rowguid

from Featured, Information
Where Featured.UniqueID = Information.UniqueID
order by Date_Activation asc

Any help with this would be greatly appreciated.

3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by abathurst
0

Try this one:

select
a.UniqueID,a.Headline,a.Description,b.Date_Activation,
case when b.Approve = '1' then 'True' when b.Approve is null then 'False' else 'False' end as Approve,
a.Ref_No as RefNo,
a.Rowguid

from Featured b inner join Information a
on a.UniqueID = b.UniqueID
order by b.Date_Activation asc

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.