Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Need help in defining the sql query

$
0
0

Hi Experts,

I am an beginner in sql queries. Any help would be greatly appreciated.

Thanks in advance.

I have 2 tables say Employee and BillingRate.

Employee

------------

EmpID

firstname

lastname

defaultbillrate

Workdate

BillingRate

--------------

EmpID

Month

Year

MonthRate

I would like to design a sql select statement something like this

select emp.firstname, emp.lastname, br.MonthRate from Employee emp, Billingrate where emp.empid = br.empid and br.month=Month(Workdate) and Year=(Workdate).

This query works perfectly fine and as expected but does not return any results when there is no record available in BillingRate table for a specified month or year.

What i need:

---------------

how to change this query to return rows even when there is no corresponding record available in BillingRate table for a specified month or year.


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>