I have this Query
SELECT PaymentDetails_ID AS Pay_ID, Type, Description, Details, Due_Date, PaymentDetails_Cleared, Amount, Mode,
(SELECT Bill_ID
FROM Bill_Payment_Records
WHERE (Payment_ID = Pay_ID)) AS Bill_No
FROM Payment_Details
WHERE (Mode = 1) AND (PaymentDetails_Cleared = 0) AND (Due_Date BETWEEN @Start_Date AND @End_Date)
over here i want to add a variable which can be used in an inside query. Like i want Bill_ID which can be determined in the query.
As i studied i don't think its possible but is there any way i can do that.