Grouping WHERE and AND as one satement [closed] - mysql

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
Im trying run this sql statement but its not working..
the select statement is ok but its just the bottom part that's giving me trouble.
SELECT VRVDIL.INVOICE_DATE,
VRVDIL.INVOICE_NO,
VRVDIL.DEAL_NO,
VRVDIL.COST,
VVD.DEAL_DATE,
VVD.SALESMAN_NAME,
VVD.SIGNED_DATE,
VVD.STOCK_NO,
VVD.VEHICLE_ID,
VVD.VEHICLE_SALES_GROUP_DESCRIPTION,
VVD.INVOICE_TO_NAME,
VRVS.DATE_SOLD,
VRVS.DAYS_IN_STOCK_BEFORE_SOLD,
VRVS.LOCATION_NAME,
VRVS.STOCKED_DATE,
VRVS.VEHICLE_CLASS_DESCRIPTION,
VRVRD.BUYER_NAME,
VRVRD.PURCHASING_PRICE,
VRVRD.SELLING_PRICE,
VRV.VIN,
VRV.VEHICLE_TYPE,
VRV.REGO_NO,
VRV.REGISTRATION_EXPIRY_DATE,
VRV.MODEL_ID,
VRV.MAKE_ID,
VRVDOL.QTY
FROM VW_RG_VEHICLE_DEAL_INVOICE_LINE VRVDIL,
VW_VEHICLE_DEAL VVD,
VW_RG_VEHICLE_DEAL_ORDER_LINE VRVDOL,
VW_RG_VEHICLE VRV,
VW_RG_VEHICLE_STOCKCARD VRVS,
VW_RG_VEHICLE_REGISTER_DETAIL VRVRD
WHERE (VRVDIL.VEHICLE_DEAL_KEY = VVD.VEHICLE_DEAL_KEY
AND VRVDOL.VEHICLE_DEAL_KEY = VVD.VEHICLE_DEAL_KEY
AND VVD.VEHICLE_KEY = VRV.VEHICLE_KEY
AND VRVS.VEHICLE_STOCKCARD_KEY = VVD.VEHICLE_STOCKCARD_KEY
AND VRVS.VEHICLE_KEY = VRV.VEHICLE_KEY
AND VRVS.VEHICLE_STOCKCARD_KEY = VRVRD.VEHICLE_STOCKCARD_KEY
what is the error?

Do you miss a closing parenthesis?
WHERE (VRVDIL.VEHICLE_DEAL_KEY = VVD.VEHICLE_DEAL_KEY
AND VRVDOL.VEHICLE_DEAL_KEY = VVD.VEHICLE_DEAL_KEY
AND VVD.VEHICLE_KEY = VRV.VEHICLE_KEY
AND VRVS.VEHICLE_STOCKCARD_KEY = VVD.VEHICLE_STOCKCARD_KEY
AND VRVS.VEHICLE_KEY = VRV.VEHICLE_KEY
AND VRVS.VEHICLE_STOCKCARD_KEY = VRVRD.VEHICLE_STOCKCARD_KEY)
At the end of the last AND condition, you should put a closing parenthesis.

Related

Why is the result of (a+b+c')(a'b'+c) not 1? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
So I got his problem as homework in my course, when I solved it the result I came up with was 1, but everywhere I check the solution stops at line 4 is if it is the final solution, but I can't spot the error in my logic for some reason!
Line1: (a+b+c')(a'b'+c)
Line2: =aa'b'+ba'b'+c'a'b'+ac+bc+c'c
Line3: =0+0+c'a'b'+ac+bc+0
Line4: =c'a'b'+ac+bc
Line5: =c'a'b'+c(a+b)
Line6: =c'+c(a'b'+(a+b))
Line7: =1*(a'b'+(a+b))
Line8: =1
You can do a very little bit better if XOR (^) is a primitive operation in your system:
Line1: (a+b+c')(a'b'+c)
Line2: = aa'b'+ba'b'+c'a'b'+ac+bc+c'c
Line3: = 0+0+c'a'b'+ac+bc+0
Line4: = c'a'b'+ac+bc
Line5: = c'a'b'+c(a+b)
Line6: = c'a'b'+c(a'b')'
Line7: = c^(a'b')
Your error is the following:
Line5: = c'a'b'+c(a+b)
Line6: = c'+c(a'b'+(a+b))
Clearly, lines 5 and 6 do not show equivalent expressions because c=0 satisfies the second regardless of a and b whereas c=0, a=1 does not satisfy the first.

Javascript - Populate country code drop down onChange of country dropdown [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there any Javascript plugin to populate country codes on change of country dropdown?
Plug-ins, not that I know of... I know answers shouldn't only include external links, but I guess this might be exception, I will include a few links in case 1 breaks one day...
Since Country names and codes don't change too often nowadays might be safe with this text extract:
http://www.textfixer.com/resources/dropdowns/country-list-iso-codes.txt
then using split(':') function, easy populate text & value of select lists
options elements like this:
function populateCountriesDropDown() {
var file = "countries.txt";
var selectList = document.getElementById('selectID');
var rawlist;
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function () {
if (rawFile.readyState === 4) {
if (rawFile.status === 200 || rawFile.status == 0) {
rawlist = rawFile.responseText.split('\n');
}
}
}
rawFile.send(null);
for (var i = 0; i < rawlist.length; i++) {
var country = rawlist[i].split(':');
selectList.options[selectList.options.length] = new Option(country[1], country[0]);
}
}
OR other links with what you might be looking for:
http://www.freeformatter.com/iso-country-list-html-select.html
https://github.com/umpirsky/country-list

Create table row for every result [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
SELECT #body1 = #body1 + '<tr><td valign="top">' + CONVERT(VARCHAR(19), GETDATE(), 120) + ' </td>'
,#body1 = #body1 + '<td valign="top">' + ISNULL(CAST(fut.nFuturesId AS varchar), ' ') + ' </td>'
,#body1 = #body1 + '<td valign="top">' + 'PaperFuturesCommodity' + ' </td></tr></table>'
FROM dbo.PositionFutures AS fut WITH(READUNCOMMITTED)
WHERE 1=1
--AND fut.strUnderlying = 'V'
AND fut.nFuturesId IN (3059, 21535)
GROUP BY fut.nFuturesId
This is the part of my stored procedure that creates the table body. The result of this right now is 2 rows, but the second one is not inside the table as picture below. Why?
Gordon Linoff has it right check your
</Table>
at the end of the select

calculate a boolean flag [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a very basic question related to boolean logic.
I have two boolean flags- flagA and flagB. I need to calculate flagC based on the values of flagA and flagB.
The code/rules are:
if($flagA && $flagB) {
$flagC = true;
} else if (!$flagA || !$flagB) {
$flagC = false;
} else if(!$flagA && !$flagB) {
$flagC = true;
}
These rules match with the XNOR truth table - http://en.wikipedia.org/wiki/XNOR_gate
I want to find out different ways to re-write the above code(if possible) with:
fewer lines of code
better performance (even if it is a minute difference)
using bit shifting?
The languages I am hoping to write this in - php, ruby/ruby on rails.
Any help/pointers will be great!
Thanks!
Don't use these languages much but this might work:
$flagC = ($flagA == $flagB);
From the link posted: http://en.wikipedia.org/wiki/XNOR_gate
two-input version implements logical equality, behaving according to the truth table to the right. A HIGH output (1) results if both of the inputs to the gate are the same. If one but not both inputs are HIGH (1), a LOW output (0) results.
So flagC is true when flagA equals flagB.
if($flagA && $flagB) {
$flagC = true;
} else {
$flagC = false;
}
(Your second rule covers all other cases.)

Can I use the function yes () to return 1 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is the following function is correct?
local function yes()
return 1
end
local function no()
return 0
end
Can I use it to set the values ​​of the variables in this way?
local May_I = yes()
if May_I ~= 0 then
-- Yes I can do that
end
I like numbers, but sometimes they are not very precise.
You can deal with the imprecision you mentioned like so:
> epsilon = 1e-2
> function yes()
>> return 1
>> end
> if math.abs( yes() - 1 ) <= epsilon then
>> print("Yes I can")
>> end
Yes I can
Or alternately, be precise and use true and false.