comma

Please Explain Comma Operator in this Program

余生长醉 提交于 2019-11-26 08:29:33
问题 Please explain me the output of this program: int main() { int a,b,c,d; a=10; b=20; c=a,b; d=(a,b); printf(\"\\nC= %d\",c); printf(\"\\nD= %d\",d); } The output which I am getting is: C= 10 D= 20 My doubt is what does the \",\" operator do here? I compiled and ran the program using Code Blocks. 回答1: The , operator evaluates a series of expressions and returns the value of the last. c=a,b is the same as (c=a),b . That is why c is 10 c=(a,b) will assign the result of a,b , which is 20, to c .

Turning a Comma Separated string into individual rows

六月ゝ 毕业季﹏ 提交于 2019-11-25 22:14:13
问题 I have a SQL Table like this: | SomeID | OtherID | Data +----------------+-------------+------------------- | abcdef-..... | cdef123-... | 18,20,22 | abcdef-..... | 4554a24-... | 17,19 | 987654-..... | 12324a2-... | 13,19,20 is there a query where I can perform a query like SELECT OtherID, SplitData WHERE SomeID = \'abcdef-.......\' that returns individual rows, like this: | OtherID | SplitData +-------------+------------------- | cdef123-... | 18 | cdef123-... | 20 | cdef123-... | 22 |