8
Answers

Problem to write a query for specific result

Pnkl

Pnkl

7y
249
1

Hello Guys,

I want take your help to solve out my question so please give me better way to implement the query to get records from search parameter

Below I have drawn one scenario and from that I want to get result

Suppose one organization held the draw of lottery ticket of various categories

LotteryTicketBuyerMaster

BuyerId(Int)

BuyerName(varchar)

EmailId

Category(varchar)

TicketNo(Varchar)

1

Nicks

[email protected]

Electronics

11001,11007

2

Nicks

[email protected]

Automobiles

14015,14020

3

James

[email protected]

Electronics

11002,11005

4

James

[email protected]

Automobiles

14016,14017

5

Mike

[email protected]

Electronics

11003

6

Nelson

[email protected]

Electronics

11004,11006

7

Mira

[email protected]

Furniture

13001

8

Jack

[email protected]

Automobiles

14018,14019

9

Mark

[email protected]

Furniture

13002,13004

10

Lary

[email protected]

Furniture

13003

 

LuckyTicketMaster

1st Day Draw

DrawDate(Date)

Category(Varchar)

LuckyTicketNo(Varchar)

01/03/2017

Electronics

11001,11003

01/03/2017

Automobiles

14016,14018

2nd Day Draw

DrawDate(Date)

Category(Varchar)

LuckyTicketNo(Varchar)

02/03/2017

Electronics

11005,11006

02/03/2017

Automobiles

14018,14020

02/03/2017

Furniture

13002,13003

And at end of the each day I want to send email to lucky winner so, how to write a query in better way to get winner Name and Email in LotteryTicketBuyerMaster from TicketNo by LuckyTicketMaster’s LuckyTicketNo

ResultTable

1st Day ResultTable

Date

BuyerName

Emailid

Category

TicketNo

01/03/2017

Nicks

[email protected]

Electronics

11001

01/03/2017

Mike

[email protected]

Electronics

11003

01/03/2017

James

[email protected]

Automobiles

14016

01/03/2017

Jack

[email protected]

Automobiles

14018

 
Answers (8)